Exception: OpenAI::Errors::APIError
- Inherits:
-
Error
- Object
- StandardError
- Error
- OpenAI::Errors::APIError
show all
- Defined in:
- lib/openai/errors.rb,
sig/openai/errors.rbs
Instance Attribute Summary collapse
Attributes inherited from Error
#cause
Instance Method Summary
collapse
Constructor Details
#initialize(url:, status: nil, headers: nil, body: nil, request: nil, response: nil, message: nil) ⇒ APIError
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 APIError.
112
113
114
115
116
117
118
119
120
|
# File 'lib/openai/errors.rb', line 112
def initialize(url:, status: nil, headers: nil, body: nil, request: nil, response: nil, message: nil)
@url = url
@status = status
@headers =
@body = body
@request = request
@response = response
super(message)
end
|
Instance Attribute Details
#body ⇒ Object?
85
86
87
|
# File 'lib/openai/errors.rb', line 85
def body
@body
end
|
#code ⇒ String?
88
89
90
|
# File 'lib/openai/errors.rb', line 88
def code
@code
end
|
82
83
84
|
# File 'lib/openai/errors.rb', line 82
def
@headers
end
|
#param ⇒ String?
91
92
93
|
# File 'lib/openai/errors.rb', line 91
def param
@param
end
|
#status ⇒ Integer?
79
80
81
|
# File 'lib/openai/errors.rb', line 79
def status
@status
end
|
#type ⇒ String?
94
95
96
|
# File 'lib/openai/errors.rb', line 94
def type
@type
end
|
#url ⇒ URI::Generic
76
77
78
|
# File 'lib/openai/errors.rb', line 76
def url
@url
end
|
Instance Method Details
#request_id ⇒ String?
The ID of the API request, returned via the x-request-id response
header. This is nil when no HTTP response was received or the response
did not include the header.
101
|
# File 'lib/openai/errors.rb', line 101
def request_id = &.[]("x-request-id")
|