errors

package
v0.7.5 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2020 License: MIT Imports: 3 Imported by: 6

Documentation

Index

Constants

View Source
const (
	MysqlConnectFailedCode = 1001
	RedisConnectFailedCode = 1002
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

Error

func Forbidden

func Forbidden(format string, v ...interface{}) *Error

Forbidden generates a 403 error.

func InternalServer

func InternalServer(format string, v ...interface{}) *Error

InternalServerError generates a 500 error.

func MethodNotAllowed

func MethodNotAllowed(format string, v ...interface{}) *Error

MethodNotAllowed generates a 405 error.

func MysqlConnectFailed

func MysqlConnectFailed(format string, v ...interface{}) *Error

MysqlConnectFailed

func New

func New(code int, message string) *Error

New

func NotFound

func NotFound(format string, v ...interface{}) *Error

NotFound generates a 404 error.

func Parse

func Parse(errStr string) *Error

Parse tries to parse a JSON string into an error. If that fails, it will set the given string as the error detail.

func RedisConnectFailed

func RedisConnectFailed(format string, v ...interface{}) *Error

RedisConnectFailed

func Timeout

func Timeout(format string, v ...interface{}) *Error

Timeout generates a 408 error.

func Unauthorized

func Unauthorized(format string, v ...interface{}) *Error

Unauthorized generates a 401 error.

func (*Error) Error

func (e *Error) Error() string

Error string

Jump to

Keyboard shortcuts

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