errors

package
v2.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ERR_NIL                              = NewError(500, -1, "", "fastapi_error", nil)
	ERR_UNKNOWN                          = NewError(500, -1, "Unknown Error.", "fastapi_error", nil)
	ERR_INTERNAL_ERROR                   = NewError(500, 500, "Internal Error.", "fastapi_error", nil)
	ERR_SERVICE_UNAVAILABLE              = NewError(503, 503, "Service Unavailable.", "fastapi_error", nil)
	ERR_NO_AVAILABLE_KEY                 = NewError(500, "fastapi_error", "No available key.", "fastapi_error", nil)
	ERR_ALL_KEY                          = NewError(500, "fastapi_error", "All key error.", "fastapi_error", nil)
	ERR_NO_AVAILABLE_MODEL_AGENT         = NewError(500, "fastapi_error", "No available model agent.", "fastapi_error", nil)
	ERR_GROUP_NO_AVAILABLE_MODEL_AGENT   = NewError(500, "fastapi_error", "The model agent for this model is not in this group.", "fastapi_error", nil)
	ERR_ALL_MODEL_AGENT                  = NewError(500, "fastapi_error", "All model agent error.", "fastapi_error", nil)
	ERR_MODEL_AGENT_HAS_BEEN_DISABLED    = NewError(500, "fastapi_error", "Model agent has been disabled.", "fastapi_error", nil)
	ERR_NO_AVAILABLE_MODEL_AGENT_KEY     = NewError(500, "fastapi_error", "No available model agent key.", "fastapi_error", nil)
	ERR_ALL_MODEL_AGENT_KEY              = NewError(500, "fastapi_error", "All model agent key error.", "fastapi_error", nil)
	ERR_MODEL_HAS_BEEN_DISABLED          = NewError(500, "fastapi_error", "Model has been disabled.", "fastapi_error", nil)
	ERR_GROUP_IS_NIL                     = NewError(500, "fastapi_error", "Group is nil.", "fastapi_error", nil)
	ERR_UNSUPPORTED_FILE_FORMAT          = NewError(400, "unsupported_file_format", "Unsupported file format.", "fastapi_request_error", nil)
	ERR_UNSUPPORTED_BILLING_METHOD_MODEL = NewError(400, "unsupported_billing_method_model", "Billing methods not supported by the current model.", "fastapi_request_error", nil)
	ERR_UNSUPPORTED_BILLING_METHOD_GROUP = NewError(400, "unsupported_billing_method_group", "Billing methods not supported by the current group.", "fastapi_request_error", nil)
	ERR_NOT_API_KEY                      = NewError(401, "invalid_request_error", "You didn't provide an API key.", "fastapi_request_error", nil)
	ERR_INVALID_API_KEY                  = NewError(401, "invalid_api_key", "Incorrect API key provided or has been disabled.", "fastapi_request_error", nil)
	ERR_API_KEY_DISABLED                 = NewError(401, "api_key_disabled", "Key has been disabled.", "fastapi_request_error", nil)
	ERR_INVALID_RESELLER                 = NewError(401, "invalid_reseller", "Reseller does not exist or has been disabled.", "fastapi_request_error", nil)
	ERR_RESELLER_DISABLED                = NewError(401, "reseller_disabled", "Reseller has been disabled.", "fastapi_request_error", nil)
	ERR_INVALID_USER                     = NewError(401, "invalid_user", "User does not exist or has been disabled.", "fastapi_request_error", nil)
	ERR_USER_DISABLED                    = NewError(401, "user_disabled", "User has been disabled.", "fastapi_request_error", nil)
	ERR_INVALID_APP                      = NewError(401, "invalid_app", "App does not exist or has been disabled.", "fastapi_request_error", nil)
	ERR_APP_DISABLED                     = NewError(401, "app_disabled", "App has been disabled.", "fastapi_request_error", nil)
	ERR_MODEL_DISABLED                   = NewError(401, "model_disabled", "Model has been disabled.", "fastapi_request_error", nil)
	ERR_GROUP_DISABLED                   = NewError(401, "group_disabled", "Group has been disabled.", "fastapi_request_error", nil)
	ERR_GROUP_EXPIRED                    = NewError(401, "group_expired", "Group has expired.", "fastapi_request_error", nil)
	ERR_FORBIDDEN                        = NewError(403, "forbidden", "Forbidden.", "fastapi_request_error", nil)
	ERR_NOT_AUTHORIZED                   = NewError(403, "not_authorized", "Not Authorized.", "fastapi_request_error", nil)
	ERR_NOT_FOUND                        = NewError(404, "unknown_url", "Unknown request URL.", "fastapi_request_error", nil)
	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", nil)
	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", nil)
	ERR_GROUP_NOT_FOUND                  = NewError(404, "group_not_found", "The group does not exist or you do not have access to it.", "fastapi_request_error", nil)
	ERR_RESELLER_INSUFFICIENT_QUOTA      = NewError(429, "reseller_insufficient_quota", "You reseller exceeded current quota.", "fastapi_request_error", nil)
	ERR_RESELLER_QUOTA_EXPIRED           = NewError(429, "reseller_quota_expired", "You reseller quota has expired.", "fastapi_request_error", nil)
	ERR_INSUFFICIENT_QUOTA               = NewError(429, "insufficient_quota", "You exceeded your current quota.", "fastapi_request_error", nil)
	ERR_ACCOUNT_QUOTA_EXPIRED            = NewError(429, "account_quota_expired", "You account quota has expired.", "fastapi_request_error", nil)
	ERR_APP_QUOTA_EXPIRED                = NewError(429, "app_quota_expired", "You app quota has expired.", "fastapi_request_error", nil)
	ERR_KEY_QUOTA_EXPIRED                = NewError(429, "key_quota_expired", "You key quota has expired.", "fastapi_request_error", nil)
	ERR_GROUP_INSUFFICIENT_QUOTA         = NewError(429, "group_insufficient_quota", "Group exceeded current quota.", "fastapi_request_error", nil)
)

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, param any) error

func NewErrorf

func NewErrorf(status int, code any, message, typ string, param any, args ...any) error

func Newf

func Newf(format string, args ...any) error

Types

type FastApiError

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

func (*FastApiError) ErrCode

func (e *FastApiError) ErrCode() any

func (*FastApiError) ErrMessage

func (e *FastApiError) ErrMessage() string

func (*FastApiError) ErrParam

func (e *FastApiError) ErrParam() any

func (*FastApiError) ErrType

func (e *FastApiError) ErrType() string

func (*FastApiError) Error

func (e *FastApiError) Error() string

func (*FastApiError) Status

func (e *FastApiError) Status() int

func (*FastApiError) Unwrap

func (e *FastApiError) Unwrap() error

type IFastApiError

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

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