errno

package
v0.0.0-...-840a1b4 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2017 License: MIT Imports: 5 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBind = &Err{
		Code:       "BIND_ERR",
		Message:    "Error occurred while binding the request body to the struct.",
		StatusCode: http.StatusBadRequest}
	ErrValidation = &Err{
		Code:       "VALIDATION_ERR",
		Message:    "Validation failed.",
		StatusCode: http.StatusBadRequest}
	ErrEncrypt = &Err{
		Code:       "ENCRYPT_ERR",
		Message:    "Error occurred while encrypting the user password.",
		StatusCode: http.StatusInternalServerError}
	ErrDatabase = &Err{
		Code:       "DB_ERR",
		Message:    "Database error.",
		StatusCode: http.StatusInternalServerError}
	ErrUserNotFound = &Err{
		Code:       "USER_NOT_FOUND",
		Message:    "The user was not found.",
		StatusCode: http.StatusNotFound}
	ErrTokenInvalid = &Err{
		Code:       "TOKEN_INVALID",
		Message:    "The token was invalid.",
		StatusCode: http.StatusForbidden}
	ErrPasswordIncorrect = &Err{
		Code:       "PASSWORD_INCORRECT",
		Message:    "The password was incorrect.",
		StatusCode: http.StatusForbidden}
	ErrToken = &Err{
		Code:       "TOKEN_ERR",
		Message:    "Error occurred while signing the JSON web token.",
		StatusCode: http.StatusBadRequest}
)

Functions

func Abort

func Abort(errStruct *Err, err error, c *gin.Context)

Abort the current request with the specified error code.

Types

type Err

type Err struct {
	Code       string
	Message    string
	StatusCode int
	Path       string
	Line       int
}

Err represents an error, `Path`, `Line`, `Code` will be automatically filled.

func Fill

func Fill(err *Err) *Err

Fill the error struct with the detail error information.

func (*Err) Error

func (e *Err) Error() string

Error returns the error message.

Jump to

Keyboard shortcuts

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