NewResponseError builds a ResponseError with the OpenAI-shaped envelope. errType and code should be one of the OpenAIErrType* and OpenAIErrCode* constants defined above.
(msg, errType, code string, status int, retryAfter time.Duration)
| 42 | // envelope. errType and code should be one of the OpenAIErrType* |
| 43 | // and OpenAIErrCode* constants defined above. |
| 44 | func NewResponseError(msg, errType, code string, status int, retryAfter time.Duration) *ResponseError { |
| 45 | return &ResponseError{ |
| 46 | ErrorObject: &shared.ErrorObject{ |
| 47 | Code: code, |
| 48 | Message: msg, |
| 49 | Type: errType, |
| 50 | }, |
| 51 | StatusCode: status, |
| 52 | RetryAfter: retryAfter, |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | func (e *ResponseError) Error() string { |
| 57 | if e.ErrorObject == nil { |
no outgoing calls