Exception: ComplyanceSDK::Exceptions::SDKException
- Inherits:
-
StandardError
- Object
- StandardError
- ComplyanceSDK::Exceptions::SDKException
- Defined in:
- lib/complyance_sdk/exceptions/sdk_exception.rb
Overview
Base exception class for all SDK exceptions
Direct Known Subclasses
APIError, CircuitBreakerOpenError, ConfigurationError, NetworkError, ValidationError, Retry::RetryExhaustedError
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Error code.
-
#context ⇒ Object
readonly
Error context.
-
#suggestion ⇒ Object
readonly
Suggested action to resolve the error.
Instance Method Summary collapse
-
#initialize(message, code: nil, context: {}, suggestion: nil) ⇒ SDKException
constructor
Initialize a new SDK exception.
-
#to_h ⇒ Hash
Convert the exception to a hash.
Constructor Details
#initialize(message, code: nil, context: {}, suggestion: nil) ⇒ SDKException
Initialize a new SDK exception
22 23 24 25 26 27 |
# File 'lib/complyance_sdk/exceptions/sdk_exception.rb', line 22 def initialize(, code: nil, context: {}, suggestion: nil) super() @code = code @context = context @suggestion = suggestion end |
Instance Attribute Details
#code ⇒ Object (readonly)
Error code
8 9 10 |
# File 'lib/complyance_sdk/exceptions/sdk_exception.rb', line 8 def code @code end |
#context ⇒ Object (readonly)
Error context
11 12 13 |
# File 'lib/complyance_sdk/exceptions/sdk_exception.rb', line 11 def context @context end |
#suggestion ⇒ Object (readonly)
Suggested action to resolve the error
14 15 16 |
# File 'lib/complyance_sdk/exceptions/sdk_exception.rb', line 14 def suggestion @suggestion end |
Instance Method Details
#to_h ⇒ Hash
Convert the exception to a hash
32 33 34 35 36 37 38 39 |
# File 'lib/complyance_sdk/exceptions/sdk_exception.rb', line 32 def to_h { code: @code, message: , context: @context, suggestion: @suggestion } end |