Exception: Google::Genai::APIError
- Defined in:
- lib/google/genai/errors.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#details ⇒ Object
readonly
Returns the value of attribute details.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(code, response_json, response) ⇒ APIError
constructor
A new instance of APIError.
Constructor Details
#initialize(code, response_json, response) ⇒ APIError
Returns a new instance of APIError.
11 12 13 14 15 16 17 18 19 |
# File 'lib/google/genai/errors.rb', line 11 def initialize(code, response_json, response) @response = response @details = response_json.is_a?(Array) && response_json.length == 1 ? response_json[0] : response_json = (@details) @status = get_status(@details) @code = code || get_code(@details) super("#{@code} #{@status}. #{@details}") end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
9 10 11 |
# File 'lib/google/genai/errors.rb', line 9 def code @code end |
#details ⇒ Object (readonly)
Returns the value of attribute details.
9 10 11 |
# File 'lib/google/genai/errors.rb', line 9 def details @details end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
9 10 11 |
# File 'lib/google/genai/errors.rb', line 9 def response @response end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
9 10 11 |
# File 'lib/google/genai/errors.rb', line 9 def status @status end |