Exception: GroqRuby::APIStatusError
- Defined in:
- lib/groq_ruby/errors/api_status_error.rb
Overview
4xx/5xx response. Carries status, headers, and the parsed body.
Direct Known Subclasses
AuthenticationError, BadRequestError, ConflictError, InternalServerError, NotFoundError, PermissionDeniedError, RateLimitError, UnprocessableEntityError
Instance Attribute Summary collapse
-
#body ⇒ Hash, ...
readonly
Decoded JSON body or raw String.
-
#headers ⇒ Hash{String => String}
readonly
Response headers.
-
#status ⇒ Integer
readonly
HTTP status code.
Attributes inherited from APIError
Instance Method Summary collapse
-
#initialize(message, status:, headers: {}, body: nil, request: nil) ⇒ APIStatusError
constructor
A new instance of APIStatusError.
Constructor Details
#initialize(message, status:, headers: {}, body: nil, request: nil) ⇒ APIStatusError
Returns a new instance of APIStatusError.
16 17 18 19 20 21 |
# File 'lib/groq_ruby/errors/api_status_error.rb', line 16 def initialize(, status:, headers: {}, body: nil, request: nil) @status = status @headers = headers @body = body super(, request: request) end |
Instance Attribute Details
#body ⇒ Hash, ... (readonly)
Returns decoded JSON body or raw String.
9 10 11 |
# File 'lib/groq_ruby/errors/api_status_error.rb', line 9 def body @body end |
#headers ⇒ Hash{String => String} (readonly)
Returns response headers.
7 8 9 |
# File 'lib/groq_ruby/errors/api_status_error.rb', line 7 def headers @headers end |
#status ⇒ Integer (readonly)
Returns HTTP status code.
5 6 7 |
# File 'lib/groq_ruby/errors/api_status_error.rb', line 5 def status @status end |