Class: Geminize::ErrorParser
- Inherits:
-
Object
- Object
- Geminize::ErrorParser
- Defined in:
- lib/geminize/error_parser.rb
Overview
Utility class for parsing error responses from the Gemini API
Instance Attribute Summary collapse
-
#response ⇒ Faraday::Response
readonly
The response object.
Class Method Summary collapse
-
.parse(response) ⇒ Hash
Parse an error response and extract relevant information.
Instance Method Summary collapse
-
#initialize(response) ⇒ ErrorParser
constructor
Initialize a new parser.
-
#parse ⇒ Hash
Parse the response and extract error information.
Constructor Details
#initialize(response) ⇒ ErrorParser
Initialize a new parser
20 21 22 |
# File 'lib/geminize/error_parser.rb', line 20 def initialize(response) @response = response end |
Instance Attribute Details
#response ⇒ Faraday::Response (readonly)
Returns The response object.
16 17 18 |
# File 'lib/geminize/error_parser.rb', line 16 def response @response end |
Class Method Details
.parse(response) ⇒ Hash
Parse an error response and extract relevant information
11 12 13 |
# File 'lib/geminize/error_parser.rb', line 11 def self.parse(response) new(response).parse end |
Instance Method Details
#parse ⇒ Hash
Parse the response and extract error information
26 27 28 29 30 31 32 |
# File 'lib/geminize/error_parser.rb', line 26 def parse { http_status: response.status, code: extract_error_code, message: } end |