Exception: OpenAI::Errors::OAuthError
Instance Attribute Summary collapse
#code, #param, #type
Attributes inherited from APIError
#body, #code, #headers, #param, #type, #url
Attributes inherited from Error
#cause
Instance Method Summary
collapse
for
Methods inherited from APIError
#request_id
Constructor Details
#initialize(status:, body:, headers:) ⇒ OAuthError
Returns a new instance of OAuthError.
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
|
# File 'lib/openai/errors.rb', line 556
def initialize(status:, body:, headers:)
error = OpenAI::Internal::Util.dig(body, :error)
@error_code = OpenAI::Internal::Type::Converter.coerce(OpenAI::Models::OAuthErrorCode, error)
message = if (error_description = OpenAI::Internal::Util.dig(body, :error_description))
error_description
elsif @error_code
@error_code
else
"OAuth2 authentication error"
end
super(
url: URI("https://auth.openai.com/oauth/token"),
status: status,
headers: ,
body: body,
request: nil,
response: nil,
message: message
)
end
|
Instance Attribute Details
#error_code ⇒ OpenAI::Models::OAuthErrorCode::Variants?
554
555
556
|
# File 'lib/openai/errors.rb', line 554
def error_code
@error_code
end
|
Instance Method Details
#status ⇒ Integer
148
|
# File 'sig/openai/errors.rbs', line 148
def status: -> Integer
|
#status= ⇒ Integer
150
|
# File 'sig/openai/errors.rbs', line 150
def status=: (Integer) -> Integer
|