Exception: EasyLabs::Error
- Inherits:
-
StandardError
- Object
- StandardError
- EasyLabs::Error
- Defined in:
- lib/easylabs/error.rb
Overview
Base class for every error this SDK raises in response to API calls. Mirrors ‘EasyApiError` in @easylabs/common.
Direct Known Subclasses
AuthenticationError, ConflictError, InvalidRequestError, NotFoundError, PermissionError, RateLimitError, ServerError
Instance Attribute Summary collapse
-
#code ⇒ String?
readonly
machine-readable code from the API’s structured error envelope, when present.
-
#details ⇒ Object?
readonly
details payload from the envelope.
-
#raw ⇒ Object?
readonly
full parsed JSON body, for callers who need fields the SDK doesn’t surface explicitly.
-
#retry_after_seconds ⇒ Integer?
readonly
parsed from the ‘Retry-After` response header for rate-limit errors.
-
#status ⇒ Integer
readonly
HTTP status code from the response.
Instance Method Summary collapse
-
#initialize(message, status:, code: nil, details: nil, retry_after_seconds: nil, raw: nil) ⇒ Error
constructor
A new instance of Error.
Constructor Details
#initialize(message, status:, code: nil, details: nil, retry_after_seconds: nil, raw: nil) ⇒ Error
Returns a new instance of Error.
18 19 20 21 22 23 24 25 |
# File 'lib/easylabs/error.rb', line 18 def initialize(, status:, code: nil, details: nil, retry_after_seconds: nil, raw: nil) super() @status = status @code = code @details = details @retry_after_seconds = retry_after_seconds @raw = raw end |
Instance Attribute Details
#code ⇒ String? (readonly)
machine-readable code from the API’s structured error envelope, when present.
15 16 17 |
# File 'lib/easylabs/error.rb', line 15 def code @code end |
#details ⇒ Object? (readonly)
details payload from the envelope.
15 16 17 |
# File 'lib/easylabs/error.rb', line 15 def details @details end |
#raw ⇒ Object? (readonly)
full parsed JSON body, for callers who need fields the SDK doesn’t surface explicitly.
15 16 17 |
# File 'lib/easylabs/error.rb', line 15 def raw @raw end |
#retry_after_seconds ⇒ Integer? (readonly)
parsed from the ‘Retry-After` response header for rate-limit errors.
15 16 17 |
# File 'lib/easylabs/error.rb', line 15 def retry_after_seconds @retry_after_seconds end |
#status ⇒ Integer (readonly)
HTTP status code from the response.
15 16 17 |
# File 'lib/easylabs/error.rb', line 15 def status @status end |