Exception: MailCapture::ApiError
- Defined in:
- lib/mailcapture/errors.rb
Overview
Raised when the API returns an unexpected status code.
Instance Attribute Summary collapse
-
#detail ⇒ String?
readonly
Human-readable detail from the server.
-
#status_code ⇒ Integer
readonly
HTTP status code.
Attributes inherited from Error
Instance Method Summary collapse
-
#initialize(detail, status_code:, code: 'UNKNOWN_ERROR') ⇒ ApiError
constructor
A new instance of ApiError.
Constructor Details
#initialize(detail, status_code:, code: 'UNKNOWN_ERROR') ⇒ ApiError
Returns a new instance of ApiError.
81 82 83 84 85 |
# File 'lib/mailcapture/errors.rb', line 81 def initialize(detail, status_code:, code: 'UNKNOWN_ERROR') @status_code = status_code @detail = detail super("API error (#{status_code}): #{detail || code}", code: code) end |
Instance Attribute Details
#detail ⇒ String? (readonly)
Returns human-readable detail from the server.
79 80 81 |
# File 'lib/mailcapture/errors.rb', line 79 def detail @detail end |
#status_code ⇒ Integer (readonly)
Returns HTTP status code.
77 78 79 |
# File 'lib/mailcapture/errors.rb', line 77 def status_code @status_code end |