Exception: Masklen::Error
- Inherits:
-
StandardError
- Object
- StandardError
- Masklen::Error
- Defined in:
- lib/masklen/error.rb
Overview
Raised when the API returns a non-2xx response or when a network error occurs.
Attributes:
status_code - HTTP status code returned by the server (Integer)
error_code - machine-readable error code from the API response body (String)
error_message - human-readable description from the API response body (String)
Instance Attribute Summary collapse
-
#error_code ⇒ Object
readonly
Returns the value of attribute error_code.
-
#error_message ⇒ Object
readonly
Returns the value of attribute error_message.
-
#status_code ⇒ Object
readonly
Returns the value of attribute status_code.
Instance Method Summary collapse
-
#initialize(status_code:, error_code:, error_message:) ⇒ Error
constructor
A new instance of Error.
Constructor Details
#initialize(status_code:, error_code:, error_message:) ⇒ Error
Returns a new instance of Error.
11 12 13 14 15 16 |
# File 'lib/masklen/error.rb', line 11 def initialize(status_code:, error_code:, error_message:) @status_code = status_code @error_code = error_code @error_message = super("Masklen API error #{status_code} (#{error_code}): #{}") end |
Instance Attribute Details
#error_code ⇒ Object (readonly)
Returns the value of attribute error_code.
9 10 11 |
# File 'lib/masklen/error.rb', line 9 def error_code @error_code end |
#error_message ⇒ Object (readonly)
Returns the value of attribute error_message.
9 10 11 |
# File 'lib/masklen/error.rb', line 9 def @error_message end |
#status_code ⇒ Object (readonly)
Returns the value of attribute status_code.
9 10 11 |
# File 'lib/masklen/error.rb', line 9 def status_code @status_code end |