Exception: ServiceNow::ApiError
- Inherits:
-
StandardError
- Object
- StandardError
- ServiceNow::ApiError
- Defined in:
- lib/servicenow/exceptions.rb
Direct Known Subclasses
BadRequestError, ForbiddenError, MethodNotAllowedError, NotAcceptableError, NotFoundError, UnauthorizedError, UnsupportedMediaTypeError
Instance Attribute Summary collapse
-
#detail ⇒ Object
readonly
Returns the value of attribute detail.
-
#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(response) ⇒ ApiError
constructor
A new instance of ApiError.
Constructor Details
#initialize(response) ⇒ ApiError
Returns a new instance of ApiError.
5 6 7 8 9 10 11 12 |
# File 'lib/servicenow/exceptions.rb', line 5 def initialize(response) @response = response if response&.body @message = response.body.dig("error", "message") @detail = response.body.dig("error", "detail") @status = response.body["status"] end end |
Instance Attribute Details
#detail ⇒ Object (readonly)
Returns the value of attribute detail.
3 4 5 |
# File 'lib/servicenow/exceptions.rb', line 3 def detail @detail end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
3 4 5 |
# File 'lib/servicenow/exceptions.rb', line 3 def @message end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
3 4 5 |
# File 'lib/servicenow/exceptions.rb', line 3 def response @response end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
3 4 5 |
# File 'lib/servicenow/exceptions.rb', line 3 def status @status end |