Exception: OpenAI::Errors::OAuthError
- Inherits:
-
APIStatusError
- Object
- StandardError
- Error
- APIError
- APIStatusError
- OpenAI::Errors::OAuthError
- Defined in:
- lib/openai/errors.rb
Instance Attribute Summary collapse
Attributes inherited from APIStatusError
Attributes inherited from APIError
#body, #code, #headers, #param, #status, #type, #url
Instance Method Summary collapse
-
#initialize(status:, body:, headers:) ⇒ OAuthError
constructor
A new instance of OAuthError.
Methods inherited from APIStatusError
Constructor Details
#initialize(status:, body:, headers:) ⇒ OAuthError
Returns a new instance of OAuthError.
271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 |
# File 'lib/openai/errors.rb', line 271 def initialize(status:, body:, headers:) @error_code = OpenAI::Internal::Type::Converter.coerce(OpenAI::Models::OAuthErrorCode, body&.dig(:error)) = if body&.dig(:error_description) body[:error_description] elsif @error_code @error_code else "OAuth2 authentication error" end super( url: URI("https://auth.openai.com/oauth/token"), status: status, headers: headers, body: body, request: nil, response: nil, message: ) end |
Instance Attribute Details
#error_code ⇒ OpenAI::Models::OAuthErrorCode::Variants? (readonly)
269 270 271 |
# File 'lib/openai/errors.rb', line 269 def error_code @error_code end |