Exception: Veryfi::Error::VeryfiError
- Inherits:
-
StandardError
- Object
- StandardError
- Veryfi::Error::VeryfiError
- Defined in:
- lib/veryfi/error.rb
Overview
Base class for every Veryfi SDK error.
#message returns the pretty-printed JSON error payload when one is
available, otherwise the formatted "<status>" / "<status>, <error>"
string. The #status and #response accessors give callers
programmatic access to the same information.
Direct Known Subclasses
AccessLimitReached, BadRequest, ClientError, Conflict, NotFound, RequestTimeout, ServerError, TooManyRequests, Unauthorized, UnsupportedMediaType
Instance Attribute Summary collapse
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(message = "An error occurred", response = {}, status = nil) ⇒ VeryfiError
constructor
A new instance of VeryfiError.
- #to_s ⇒ Object
Constructor Details
#initialize(message = "An error occurred", response = {}, status = nil) ⇒ VeryfiError
Returns a new instance of VeryfiError.
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/veryfi/error.rb', line 37 def initialize( = "An error occurred", response = {}, status = nil) @status = status @response = response @message = if response.nil? || response.empty? else JSON.pretty_generate(response) end super(@message) end |
Instance Attribute Details
#message ⇒ Object (readonly)
Returns the value of attribute message.
35 36 37 |
# File 'lib/veryfi/error.rb', line 35 def @message end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
35 36 37 |
# File 'lib/veryfi/error.rb', line 35 def response @response end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
35 36 37 |
# File 'lib/veryfi/error.rb', line 35 def status @status end |
Instance Method Details
#to_s ⇒ Object
48 49 50 |
# File 'lib/veryfi/error.rb', line 48 def to_s end |