errors

package
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 1, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ERR_NIL                           = NewError(500, -1, "", "fastapi_error")
	ERR_UNKNOWN                       = NewError(500, -1, "Unknown Error.", "fastapi_error")
	ERR_INTERNAL_ERROR                = NewError(500, 500, "Internal Error.", "fastapi_error")
	ERR_NO_AVAILABLE_KEY              = NewError(500, "fastapi_error", "No available key.", "fastapi_error")
	ERR_ALL_KEY                       = NewError(500, "fastapi_error", "All key error.", "fastapi_error")
	ERR_NO_AVAILABLE_MODEL_AGENT      = NewError(500, "fastapi_error", "No available model agent.", "fastapi_error")
	ERR_ALL_MODEL_AGENT               = NewError(500, "fastapi_error", "All model agent error.", "fastapi_error")
	ERR_MODEL_AGENT_HAS_BEEN_DISABLED = NewError(500, "fastapi_error", "Model agent has been disabled.", "fastapi_error")
	ERR_NO_AVAILABLE_MODEL_AGENT_KEY  = NewError(500, "fastapi_error", "No available model agent key.", "fastapi_error")
	ERR_ALL_MODEL_AGENT_KEY           = NewError(500, "fastapi_error", "All model agent key error.", "fastapi_error")
	ERR_MODEL_HAS_BEEN_DISABLED       = NewError(500, "fastapi_error", "Model has been disabled.", "fastapi_error")
	ERR_INVALID_PARAMETER             = NewError(400, "invalid_parameter", "Invalid Parameter.", "fastapi_request_error")
	ERR_UNSUPPORTED_FILE_FORMAT       = NewError(400, "unsupported_file_format", "Unsupported file format.", "fastapi_request_error")
	ERR_NOT_API_KEY                   = NewError(401, "invalid_request_error", "You didn't provide an API key.", "fastapi_request_error")
	ERR_INVALID_API_KEY               = NewError(401, "invalid_api_key", "Incorrect API key provided or has been disabled.", "fastapi_request_error")
	ERR_API_KEY_DISABLED              = NewError(401, "api_key_disabled", "Key has been disabled.", "fastapi_request_error")
	ERR_INVALID_USER                  = NewError(401, "invalid_user", "User does not exist or has been disabled.", "fastapi_request_error")
	ERR_USER_DISABLED                 = NewError(401, "user_disabled", "User has been disabled.", "fastapi_request_error")
	ERR_INVALID_APP                   = NewError(401, "invalid_app", "App does not exist or has been disabled.", "fastapi_request_error")
	ERR_APP_DISABLED                  = NewError(401, "app_disabled", "App has been disabled.", "fastapi_request_error")
	ERR_MODEL_DISABLED                = NewError(401, "model_disabled", "Model has been disabled.", "fastapi_request_error")
	ERR_FORBIDDEN                     = NewError(403, "forbidden", "Forbidden.", "fastapi_request_error")
	ERR_NOT_AUTHORIZED                = NewError(403, "not_authorized", "Not Authorized.", "fastapi_request_error")
	ERR_NOT_FOUND                     = NewError(404, "unknown_url", "Unknown request URL.", "fastapi_request_error")
	ERR_MODEL_NOT_FOUND               = NewError(404, "model_not_found", "The model does not exist or you do not have access to it.", "fastapi_request_error")
	ERR_PATH_NOT_FOUND                = NewError(404, "path_not_found", "The path does not exist or you do not have access to it.", "fastapi_request_error")
	ERR_INSUFFICIENT_QUOTA            = NewError(429, "insufficient_quota", "You exceeded your current quota.", "fastapi_request_error")
	ERR_ACCOUNT_QUOTA_EXPIRED         = NewError(429, "account_quota_expired", "You account quota has expired.", "fastapi_request_error")
	ERR_APP_QUOTA_EXPIRED             = NewError(429, "app_quota_expired", "You app quota has expired.", "fastapi_request_error")
	ERR_KEY_QUOTA_EXPIRED             = NewError(429, "key_quota_expired", "You key quota has expired.", "fastapi_request_error")
)

Functions

func As

func As(err error, target any) bool

func Is

func Is(err, target error) bool

func New

func New(text string) error

func NewError

func NewError(status int, code any, message, typ string) error

func NewErrorf added in v0.2.0

func NewErrorf(status int, code any, message, typ string, args ...interface{}) error

func Newf

func Newf(format string, args ...interface{}) error

Types

type FastApiError added in v0.2.0

type FastApiError struct {
	Err *sdkerr.ApiError `json:"error,omitempty"`
}

func (*FastApiError) ErrCode added in v0.2.0

func (e *FastApiError) ErrCode() any

func (*FastApiError) ErrMessage added in v0.2.0

func (e *FastApiError) ErrMessage() string

func (*FastApiError) ErrType added in v0.2.0

func (e *FastApiError) ErrType() string

func (*FastApiError) Error added in v0.2.0

func (e *FastApiError) Error() string

func (*FastApiError) Status added in v0.2.0

func (e *FastApiError) Status() int

func (*FastApiError) Unwrap added in v0.2.0

func (e *FastApiError) Unwrap() error

type IFastApiError added in v0.2.0

type IFastApiError interface {
	Unwrap() error
	Status() int
	ErrCode() any
	ErrMessage() string
	ErrType() string
}

func Error

func Error(ctx context.Context, err error) (iFastApiError IFastApiError)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳