Exception: JuspayError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/errors/juspay_error.rb

Instance Method Summary collapse

Constructor Details

#initialize(message = nil, http_status = nil, json_body = nil) ⇒ JuspayError

Returns a new instance of JuspayError.



3
4
5
6
7
# File 'lib/errors/juspay_error.rb', line 3

def initialize(message=nil, http_status=nil, json_body=nil)
  @_message = message
  @http_status = http_status
  @json_body = json_body
end

Instance Method Details

#to_sObject



9
10
11
12
13
# File 'lib/errors/juspay_error.rb', line 9

def to_s
  status_string = @http_status.nil? ? '' : "(Status #{@http_status})\n"
  json_string = @json_body.nil? ? '' : "(Response #{@json_body})\n"
  "\n#{status_string}#{json_string}#{@_message}\n"
end