Documentation
¶
Index ¶
- Variables
- func As(err error, target any) bool
- func Is(err, target error) bool
- func New(text string) error
- func NewApiError(httpStatusCode int, code any, message, typ string, param any) error
- func NewRequestError(httpStatusCode int, err error) error
- func Newf(format string, args ...any) error
- type ApiError
- type ErrorResponse
- type RequestError
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ERR_CONTEXT_LENGTH_EXCEEDED = NewApiError(400, "context_length_exceeded", "Please reduce the length of the messages.", "invalid_request_error", "messages") ERR_INVALID_API_KEY = NewApiError(401, "invalid_api_key", "Incorrect API key provided or has been disabled.", "invalid_request_error", "") ERR_MODEL_NOT_FOUND = NewApiError(404, "model_not_found", "The model does not exist or you do not have access to it.", "invalid_request_error", "") ERR_INSUFFICIENT_QUOTA = NewApiError(429, "insufficient_quota", "You exceeded your current quota.", "insufficient_quota", "") ERR_RATE_LIMIT_EXCEEDED = NewApiError(429, "rate_limit_exceeded", "Rate limit reached, Please try again later.", "requests", "") )
Functions ¶
func NewApiError ¶
func NewRequestError ¶
Types ¶
type ApiError ¶
type ApiError struct {
HttpStatusCode int `json:"-"`
Code any `json:"code"`
Message string `json:"message"`
Type string `json:"type"`
Param any `json:"param"`
}
func (*ApiError) UnmarshalJSON ¶
type ErrorResponse ¶
type ErrorResponse struct {
Error *ApiError `json:"error,omitempty"`
}
type RequestError ¶
func (*RequestError) Error ¶
func (e *RequestError) Error() string
func (*RequestError) Unwrap ¶
func (e *RequestError) Unwrap() error
Click to show internal directories.
Click to hide internal directories.