bcode

package
v0.0.0-...-7161ace Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUnsupportedEmailModification is the error of unsupported email modification
	ErrUnsupportedEmailModification = NewBcode(20001, "the user already has an email address and cannot modify it again")
	// ErrUserAlreadyDisabled is the error of user already disabled
	ErrUserAlreadyDisabled = NewBcode(20002, "the user is already disabled")
	// ErrUserAlreadyEnabled is the error of user already enabled
	ErrUserAlreadyEnabled = NewBcode(20003, "the user is already enabled")
	// ErrUserCannotModified is the error of user cannot modified
	ErrUserCannotModified = NewBcode(20004, "the user cannot be modified in dex login mode")
	// ErrUserInvalidPassword is the error of user invalid password
	ErrUserInvalidPassword = NewBcode(20005, "the password is invalid")
	// ErrUserInconsistentPassword is the error of user inconsistent password
	ErrUserInconsistentPassword = NewBcode(20007, "the password is inconsistent with the user")
	// ErrUsernameNotExist is the error of username not exist
	ErrUsernameNotExist = NewBcode(20008, "the username is not exist")
	// ErrDexNotFound is the error of dex not found
	// ErrEmptyAdminEmail is the error of empty admin email
	ErrEmptyAdminEmail = NewBcode(20010, "the admin email is empty, please set the admin email before using sso login")
	// ErrNoAdminUser is the error of no admin user
	ErrNoAdminUser = NewBcode(20011, "the admin user is not found, please init the platform first")
)
View Source
var (
	// ErrUnsupportedLoginType is the error of unsupported login type
	ErrUnsupportedLoginType = NewBcode(30001, "the login type is not supported")
	// ErrTokenExpired is the error of token expired
	ErrTokenExpired = NewBcode(30002, "the token is expired")
	// ErrTokenNotValidYet is the error of token not valid yet
	ErrTokenNotValidYet = NewBcode(30003, "the token is not valid yet")
	// ErrTokenInvalid is the error of token invalid
	ErrTokenInvalid = NewBcode(30004, "the token is invalid")
	// ErrTokenMalformed is the error of token malformed
	ErrTokenMalformed = NewBcode(30005, "the token is malformed")
	// ErrNotAuthorized is the error of not authorized
	ErrNotAuthorized = NewBcode(30006, "the user is not authorized")
	// ErrNotAccessToken is the error of not access token
	ErrNotAccessToken = NewBcode(30007, "the token is not an access token")
	// ErrInvalidLoginRequest is the error of invalid login request
	ErrInvalidLoginRequest = NewBcode(30008, "the login request is invalid")
	// ErrInvalidDexConfig is the error of invalid dex config
	ErrInvalidDexConfig = NewBcode(30009, "the dex config is invalid")
	// ErrRefreshTokenExpired is the error of refresh token expired
	ErrRefreshTokenExpired = NewBcode(30010, "the refresh token is expired")
	// ErrNoDexConnector is the error of no dex connector
	ErrNoDexConnector = NewBcode(30011, "there is no dex connector")
	// ErrAdminAlreadyConfigured is the error of admin user is already configured
	ErrAdminAlreadyConfigured = NewBcode(30030, "admin user is already configured")

	ErrInvalidToken = NewBcode(30012, "invalid token")
)
View Source
var ErrForbidden = NewBcode(403, "403 Forbidden")

ErrForbidden check user perms failure

View Source
var ErrInvalidRequest = NewBcode(400, "The request is invalid.")
View Source
var ErrNotFound = NewBcode(404, "404 Not Found")

ErrNotFound the request resource is not found

View Source
var (
	ErrRecordExist = NewBcode(10001, "Record already exists")
)
View Source
var ErrServer = NewBcode(500, "The service has lapsed.")
View Source
var ErrUnauthorized = NewBcode(401, "401 Unauthorized")

ErrUnauthorized check user auth failure

View Source
var ErrUpstreamNotFound = NewBcode(502, "Upstream not found")

ErrUpstreamNotFound the proxy upstream is not found

Functions

func ErrRequestValidation

func ErrRequestValidation(c *fiber.Ctx) error

func MatchDBErr

func MatchDBErr(err error, c *fiber.Ctx) error

func New

func New(c *fiber.Ctx, bcode *Bcode) error

func ReturnError

func ReturnError(c *fiber.Ctx, err error) error

Types

type Bcode

type Bcode struct {
	Code    int32  `json:"code"`
	Message string `json:"message"`
}

func NewBcode

func NewBcode(businessCode int32, message string) *Bcode

func (*Bcode) Error

func (b *Bcode) Error() string

Jump to

Keyboard shortcuts

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