Exception: ComplyanceSDK::Exceptions::APIError
- Inherits:
-
SDKException
- Object
- StandardError
- SDKException
- ComplyanceSDK::Exceptions::APIError
- Defined in:
- lib/complyance_sdk/exceptions/sdk_exception.rb
Overview
Exception raised when an API error occurs
Instance Attribute Summary collapse
-
#status_code ⇒ Object
readonly
HTTP status code.
Attributes inherited from SDKException
Instance Method Summary collapse
-
#error_detail ⇒ Hash
Get error detail (alias for context).
-
#initialize(message = "API error", status_code: nil, **kwargs) ⇒ APIError
constructor
Initialize a new API error.
-
#to_h ⇒ Hash
Convert the exception to a hash.
Constructor Details
#initialize(message = "API error", status_code: nil, **kwargs) ⇒ APIError
Initialize a new API error
73 74 75 76 |
# File 'lib/complyance_sdk/exceptions/sdk_exception.rb', line 73 def initialize( = "API error", status_code: nil, **kwargs) super(, code: :api_error, **kwargs) @status_code = status_code end |
Instance Attribute Details
#status_code ⇒ Object (readonly)
HTTP status code
66 67 68 |
# File 'lib/complyance_sdk/exceptions/sdk_exception.rb', line 66 def status_code @status_code end |
Instance Method Details
#error_detail ⇒ Hash
Get error detail (alias for context)
81 82 83 |
# File 'lib/complyance_sdk/exceptions/sdk_exception.rb', line 81 def error_detail @context end |
#to_h ⇒ Hash
Convert the exception to a hash
88 89 90 |
# File 'lib/complyance_sdk/exceptions/sdk_exception.rb', line 88 def to_h super.merge(status_code: @status_code) end |