errs

package
v0.0.0-...-8df9fff Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2023 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SERVER_ERROR = "SERVER_ERROR"
	CLIENT_ERROR = "CLIENT_ERROR"
)
View Source
var (
	ErrBadRequest                         = makeClientError(400000, "BAD_REQUEST", nil)
	ErrCreateNewAccountRequestInvalid     = makeClientError(400001, "CREATE_ACCOUNT_REQUEST_INVALID", nil)
	ErrCreateNewAccountRequestRoleInvalid = makeClientError(400001, "CREATE_ACCOUNT_REQUEST_ROLE_INVALID", nil)

	ErrUnAuthorized        = makeClientError(401000, "UNAUTHORIZED", nil)
	ErrAccessTokenExpired  = makeClientError(401001, "ACCESS_TOKEN_EXPIRED", nil)
	ErrAccessTokenNotExist = makeClientError(401002, "ACCESS_TOKEN_NOT_EXIST", nil)

	ErrForbidden        = makeClientError(403000, "FORBIDDEN", nil)
	ErrUserNotAllow     = makeClientError(403001, "USER_NOT_ALLOW", nil)
	ErrUserCanNotAccess = makeClientError(403002, "USER_CAN_NOT_ACCESSS", nil)

	ErrNotFound     = makeClientError(404000, "NOT_FOUND", nil)
	ErrUserNotExist = makeClientError(404001, "USER_NOT_EXIST", nil)

	ErrInternalServer = makeServerError(500000, "INTERNAL_SERVER_ERROR", nil)
	ErrDBFailed       = makeServerError(500003, "DB_ERROR", nil)
)

Functions

func FilterErrNotFoundOrInternal

func FilterErrNotFoundOrInternal(err error, newErr error) error

func IsClientError

func IsClientError(err error) bool

func IsRecordNotFound

func IsRecordNotFound(err error) bool

func IsServerError

func IsServerError(err error) bool

Types

type ClientError

type ClientError struct {
	// contains filtered or unexported fields
}

func (ClientError) Error

func (e ClientError) Error() string

func (ClientError) WithErr

func (e ClientError) WithErr(err error) ClientError

type ServerError

type ServerError struct {
	// contains filtered or unexported fields
}

func (ServerError) Error

func (e ServerError) Error() string

func (ServerError) WithErr

func (e ServerError) WithErr(err error) ServerError

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL