stderr

package
v0.0.0-...-37e6509 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2020 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCodes = make(map[int]*errCode)

	/* General Errors */
	OK             = newErrCode(200, "OK", "成功")
	NotSupported   = newErrCode(300, "Not Supported", "系统不支持")
	NotFound       = newErrCode(400, "Not Found", "数据不存在")
	NotImplemented = newErrCode(600, "Not Implemented", "逻辑未实现")
	Unexpected     = newErrCode(999, "Unexpected Error", "未知错误")

	/* Resource Errors: 100,000 - 100,999 */
	ResourceNotFound      = newErrCode(100404, "Resource Not Found", "资源不存在")
	ResourceAccessFailure = newErrCode(100501, "Resource Access Failure", "资源访问失败")
	ResourceUpdateFailure = newErrCode(100502, "Resource Update Failure", "资源修改失败")
	ResourceDeleteFailure = newErrCode(100503, "Resource Delete Failure", "资源删除失败")

	/* Control Errors: 200,000 - 200,999 */
	InvalidStatusTransition = newErrCode(200501, "Invalid Status Transition", "非法的状态切换")
)

Functions

func IsNotFound

func IsNotFound(err error) bool

Types

type StdError

type StdError struct {
	Code     int    `json:"code,omitempty"`
	CodeDesc string `json:"code_desc,omitempty"`
	Message  string `json:"message,omitempty"`
	Trace    string `json:"trace,omitempty"`
}

Jump to

Keyboard shortcuts

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