Method: OpenAI::Errors::APIStatusError#initialize
- Defined in:
- lib/openai/errors.rb
#initialize(url:, status:, body:, request:, response:, message: nil) ⇒ APIStatusError
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of APIStatusError.
205 206 207 208 209 210 211 212 213 214 215 216 217 218 |
# File 'lib/openai/errors.rb', line 205 def initialize(url:, status:, body:, request:, response:, message: nil) ||= OpenAI::Internal::Util.dig(body, :message) { {url: url.to_s, status: status, body: body} } @code = OpenAI::Internal::Type::Converter.coerce(String, OpenAI::Internal::Util.dig(body, :code)) @param = OpenAI::Internal::Type::Converter.coerce(String, OpenAI::Internal::Util.dig(body, :param)) @type = OpenAI::Internal::Type::Converter.coerce(String, OpenAI::Internal::Util.dig(body, :type)) super( url: url, status: status, body: body, request: request, response: response, message: &.to_s ) end |