bcode

package
v0.0.0-...-cc62b12 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUnsupportedLoginType is the error of unsupported login type
	ErrUnsupportedLoginType = NewBcode(401, 12001, "the login type is not supported")
	// ErrTokenExpired is the error of token expired
	ErrTokenExpired = NewBcode(401, 12002, "the token is expired")
	// ErrTokenNotValidYet is the error of token not valid yet
	ErrTokenNotValidYet = NewBcode(401, 12003, "the token is not valid yet")
	// ErrTokenInvalid is the error of token invalid
	ErrTokenInvalid = NewBcode(401, 12004, "the token is invalid")
	// ErrTokenMalformed is the error of token malformed
	ErrTokenMalformed = NewBcode(403, 12005, "the token is malformed")
	// ErrNotAuthorized is the error of not authorized
	ErrNotAuthorized = NewBcode(401, 12006, "the user is not authorized")
	// ErrNotAccessToken is the error of not access token
	ErrNotAccessToken = NewBcode(401, 12007, "the token is not an access token")
	// ErrInvalidLoginRequest is the error of invalid login request
	ErrInvalidLoginRequest = NewBcode(400, 12008, "the login request is invalid")
	// ErrInvalidDexConfig is the error of invalid dex config
	ErrInvalidDexConfig = NewBcode(400, 12009, "the dex config is invalid")
	// ErrRefreshTokenExpired is the error of refresh token expired
	ErrRefreshTokenExpired = NewBcode(400, 12010, "the refresh token is expired")
	// ErrNoDexConnector is the error of no dex connector
	ErrNoDexConnector = NewBcode(400, 12011, "there is no dex connector")
)
View Source
var (
	// ErrUnsupportedEmailModification is the error of unsupported email modification
	ErrUnsupportedEmailModification = NewBcode(400, 14001, "the user already has an email address and cannot modify it again")
	// ErrUserAlreadyDisabled is the error of user already disabled
	ErrUserAlreadyDisabled = NewBcode(400, 14002, "the user is already disabled")
	// ErrUserAlreadyEnabled is the error of user already enabled
	ErrUserAlreadyEnabled = NewBcode(400, 14003, "the user is already enabled")
	// ErrUserCannotModified is the error of user cannot modified
	ErrUserCannotModified = NewBcode(400, 14004, "the user cannot be modified in dex login mode")
	// ErrUserInvalidPassword is the error of user invalid password
	ErrUserInvalidPassword = NewBcode(400, 14005, "the password is invalid")
	// ErrDexConfigNotFound means the dex config is not configured
	ErrDexConfigNotFound = NewBcode(200, 14006, "the dex config is not found")
	// ErrUserInconsistentPassword is the error of user inconsistent password
	ErrUserInconsistentPassword = NewBcode(401, 14007, "the password is inconsistent with the user")
	// ErrUsernameNotExist is the error of username not exist
	ErrUsernameNotExist = NewBcode(401, 14008, "the username is not exist")
	// ErrDexNotFound is the error of dex not found
	ErrDexNotFound = NewBcode(200, 14009, "the dex is not found")
	// ErrEmptyAdminEmail is the error of empty admin email
	ErrEmptyAdminEmail = NewBcode(400, 14010, "the admin email is empty, please set the admin email before using sso login")
)
View Source
var ErrForbidden = NewBcode(403, 403, "403 Forbidden")

ErrForbidden check user perms failure

View Source
var ErrServer = NewBcode(500, 500, "The service has lapsed.")

ErrServer an unexpected mistake.

View Source
var ErrUnauthorized = NewBcode(401, 401, "401 Unauthorized")

ErrUnauthorized check user auth failure

Functions

func ReturnError

func ReturnError(req *restful.Request, res *restful.Response, err error)

Types

type Bcode

type Bcode struct {
	HTTPCode     int32 `json:"-"`
	BusinessCode int32
	Message      string
}

func NewBcode

func NewBcode(httpCode, 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