Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( OK = _add(0) // 正确 NotModified = _add(-304) // 木有改动 TemporaryRedirect = _add(-307) // 302跳转 RequestErr = _add(-400) // 请求错误 AccessDenied = _add(-403) // 访问权限不足 NothingFound = _add(-404) // 啥都木有 MethodNotAllowed = _add(-405) // 不支持该方法 Conflict = _add(-409) // 冲突 Canceled = _add(-498) // 客户端取消请求 ServerErr = _add(-500) // 服务器错误 Deadline = _add(-504) // 服务调用超时 LimitExceed = _add(-509) // 超出限制 (服务端限流返回此错误) )
全局错误码,可以被外部引用!NotModified/TemporaryRedirect...
Functions ¶
Types ¶
type Code ¶
type Code int
Code 是 Codes实例化类型,本项目的错误码就是int,因为Codes实现了Error()方法,所以可以直接当做error返回 A Code is an int error code spec.
type Codes ¶
type Codes interface { // sometimes Error return Code in string form // NOTE: don't use Error in monitor report even it also work for now Error() string // Code get error code. Code() int // Message get code message. Message() string //Detail get error detail,it may be nil. Details() []interface{} }
Codes ecode error interface which has a code & message.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.