er

package
v1.3.7 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2021 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidID means given id is invalid
	ErrInvalidID = newAPPError(http.StatusBadRequest, 40001, "invalid id")

	// ErrInvalidPage means given page is invalid which MUST be greater than 0
	ErrInvalidPage = newAPPError(http.StatusBadRequest, 40002, "page MUST be greater than 0")

	// ErrInvalidSize means given size is invalid which MUST be greater than 0
	ErrInvalidSize = newAPPError(http.StatusBadRequest, 40003, "size MUST be greater than 0")

	// ErrEmptyTitle means give title of task is empty value
	ErrEmptyTitle = newAPPError(http.StatusBadRequest, 40004, "title must be NOT empty")

	// ErrEmptyEmail means email must be NOT empty
	ErrEmptyEmail = newAPPError(http.StatusBadRequest, 40005, "email must be NOT empty")

	// ErrEmptyPassword means password must be NOT empty
	ErrEmptyPassword = newAPPError(http.StatusBadRequest, 40005, "password must be NOT empty")

	// ErrUserEmailExists means user email is exists
	ErrUserEmailExists = newAPPError(http.StatusBadRequest, 40006, "user email is exists")
)
View Source
var (
	// ErrMissingToken means missing token in header
	ErrMissingToken = newAPPError(http.StatusUnauthorized, 40100, "missing token")

	// ErrAuthHeaderFormat means must provide Authorization header with format `Bearer {token}`
	ErrAuthHeaderFormat = newAPPError(http.StatusUnauthorized, 40101, "Must provide Authorization header with format `Bearer {token}`")

	// ErrIncorrectPassword means incorrect password
	ErrIncorrectPassword = newAPPError(http.StatusUnauthorized, 40102, "incorrect password")

	// ErrExpiredToken means token is expired
	ErrExpiredToken = newAPPError(http.StatusUnauthorized, 40103, "token is expired")
)
View Source
var (
	// ErrGetUserByID means get user by id is failure
	ErrGetUserByID = newAPPError(http.StatusInternalServerError, 50000, "get user by id is failure")

	// ErrGetUserByToken means get user by token is failure
	ErrGetUserByToken = newAPPError(http.StatusInternalServerError, 50001, "get user by token is failure")

	// ErrGetUserByEmail means get user by email is failure
	ErrGetUserByEmail = newAPPError(http.StatusInternalServerError, 50001, "get user by email is failure")

	// ErrEncryptPassword means encrypt password is failure
	ErrEncryptPassword = newAPPError(http.StatusInternalServerError, 50002, "encrypt password is failure")

	// ErrSignup means signup is failure
	ErrSignup = newAPPError(http.StatusInternalServerError, 50003, "signup is failure")

	// ErrNewToken means new a jwt is failure
	ErrNewToken = newAPPError(http.StatusInternalServerError, 50004, "new a jwt is failure")

	// ErrUpdateToken means update token by user id is failure
	ErrUpdateToken = newAPPError(http.StatusInternalServerError, 50005, "update token by user id is failure")

	// ErrLogin means login is failure
	ErrLogin = newAPPError(http.StatusInternalServerError, 50005, "login is failure")

	// ErrValidateToken means couldn't parse claims
	ErrValidateToken = newAPPError(http.StatusInternalServerError, 50006, "Couldn't parse claims")
)
View Source
var (
	// ErrReadiness means readiness is failure
	ErrReadiness = newAPPError(http.StatusInternalServerError, 50010, "readiness is failure")

	// ErrLiveness means liveness is failure
	ErrLiveness = newAPPError(http.StatusInternalServerError, 50011, "liveness is failure")
)
View Source
var (
	// ErrCreateGoal means create a objective is failure
	ErrCreateGoal = newAPPError(http.StatusInternalServerError, 50020, "create an objective is failure")

	// ErrListGoals means list all objectives is failure
	ErrListGoals = newAPPError(http.StatusInternalServerError, 50021, "list all objectives is failure")

	// ErrGoalNotExists means objective not exists
	ErrGoalNotExists = newAPPError(http.StatusNotFound, 50022, "objective not exists")

	// ErrCountGoal means count all objectives is failure
	ErrCountGoal = newAPPError(http.StatusInternalServerError, 50023, "count objective is failure")

	// ErrUpdateGoal means update a objective is failure
	ErrUpdateGoal = newAPPError(http.StatusInternalServerError, 50024, "update a objective is failure")

	// ErrGetGoalByID means get objective by id is failure
	ErrGetGoalByID = newAPPError(http.StatusInternalServerError, 50025, "get objective by id is failure")

	// ErrDeleteGoal means delete a objective by id is failure
	ErrDeleteGoal = newAPPError(http.StatusInternalServerError, 50026, "delete a objective by id is failure")
)
View Source
var (
	// ErrCreateTask means create a task is failure
	ErrCreateTask = newAPPError(http.StatusInternalServerError, 50030, "create a task is failure")

	// ErrUpdateTask means update a task is failure
	ErrUpdateTask = newAPPError(http.StatusInternalServerError, 50031, "update a task is failure")

	// ErrGetTaskByID means get task by id is failure
	ErrGetTaskByID = newAPPError(http.StatusInternalServerError, 50032, "get task by id is failure")

	// ErrListTasks means list all tasks is failure
	ErrListTasks = newAPPError(http.StatusInternalServerError, 50033, "list all tasks is failure")

	// ErrDeleteTask means delete a task is failure
	ErrDeleteTask = newAPPError(http.StatusInternalServerError, 50034, "delete a task is failure")

	// ErrTaskNotExists means task is not exists
	ErrTaskNotExists = newAPPError(http.StatusNotFound, 50035, "task is not exists")
)
View Source
var (
	// ErrGetKRByID means get a key result by id is failure
	ErrGetKRByID = newAPPError(http.StatusInternalServerError, 50040, "get a key result by id is failure")

	// ErrKRNotExists means key result not exists
	ErrKRNotExists = newAPPError(http.StatusNotFound, 50041, "key result not exists")

	// ErrListKR means list all key results is failure
	ErrListKR = newAPPError(http.StatusInternalServerError, 50042, "list all key results is failure")

	// ErrDeleteKR means delete a key result is failure
	ErrDeleteKR = newAPPError(http.StatusInternalServerError, 50043, "delete a key result is failure")

	// ErrUpdateKR means update a key result is failure
	ErrUpdateKR = newAPPError(http.StatusInternalServerError, 50044, "update a key result is failure")

	// ErrCreateKR means create a key result is failure
	ErrCreateKR = newAPPError(http.StatusInternalServerError, 50045, "create a key result is failure")
)
View Source
var (
	// ErrDBConnect means db connect is failure
	ErrDBConnect = newAPPError(http.StatusInternalServerError, 50001, "db connect is failure")

	// ErrPing means db ping is failure
	ErrPing = newAPPError(http.StatusInternalServerError, 50002, "db ping is failure")
)
View Source
var (
	// ErrRateLimit means too many requests
	ErrRateLimit = newAPPError(http.StatusTooManyRequests, 42900, "too many requests")
)
View Source
var (
	// ErrUserNotExists means user is not exists
	ErrUserNotExists = newAPPError(http.StatusNotFound, 40400, "user is not exists")
)

Functions

This section is empty.

Types

type APPError

type APPError struct {
	Status int    `json:"-"`
	Code   int    `json:"code"`
	Msg    string `json:"msg"`
}

APPError declare custom error

func (*APPError) Error

func (e *APPError) Error() string

Jump to

Keyboard shortcuts

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