Exception: DilisensePepClient::Error
- Inherits:
-
StandardError
- Object
- StandardError
- DilisensePepClient::Error
- Defined in:
- lib/dilisense_pep_client/errors.rb
Overview
Base error class for all DilisensePepClient exceptions Provides enhanced error handling with context, timestamps, and request tracking All other error classes inherit from this base class
Direct Known Subclasses
APIError, CircuitBreakerError, ComplianceError, ConfigurationError, DataProcessingError, NetworkError, ValidationError
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#error_code ⇒ Object
readonly
Returns the value of attribute error_code.
-
#request_id ⇒ Object
readonly
Returns the value of attribute request_id.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
Instance Method Summary collapse
-
#initialize(message, error_code: nil, context: {}, request_id: nil) ⇒ Error
constructor
A new instance of Error.
- #retryable? ⇒ Boolean
- #security_event? ⇒ Boolean
- #to_h ⇒ Object
Constructor Details
#initialize(message, error_code: nil, context: {}, request_id: nil) ⇒ Error
Returns a new instance of Error.
19 20 21 22 23 24 25 26 27 |
# File 'lib/dilisense_pep_client/errors.rb', line 19 def initialize(, error_code: nil, context: {}, request_id: nil) super() @error_code = error_code @context = context || {} @timestamp = Time.now.utc.iso8601 @request_id = request_id || generate_request_id log_error end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
17 18 19 |
# File 'lib/dilisense_pep_client/errors.rb', line 17 def context @context end |
#error_code ⇒ Object (readonly)
Returns the value of attribute error_code.
17 18 19 |
# File 'lib/dilisense_pep_client/errors.rb', line 17 def error_code @error_code end |
#request_id ⇒ Object (readonly)
Returns the value of attribute request_id.
17 18 19 |
# File 'lib/dilisense_pep_client/errors.rb', line 17 def request_id @request_id end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
17 18 19 |
# File 'lib/dilisense_pep_client/errors.rb', line 17 def @timestamp end |
Instance Method Details
#retryable? ⇒ Boolean
41 42 43 |
# File 'lib/dilisense_pep_client/errors.rb', line 41 def retryable? false end |
#security_event? ⇒ Boolean
45 46 47 |
# File 'lib/dilisense_pep_client/errors.rb', line 45 def security_event? false end |
#to_h ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/dilisense_pep_client/errors.rb', line 29 def to_h { error_type: self.class.name, message: , error_code: error_code, context: context, timestamp: , request_id: request_id, backtrace: backtrace&.first(10) } end |