Documentation
¶
Index ¶
- Variables
- func IsNetErrClosing(err error) bool
- func IsNetErrorTimeout(err error) bool
- type Error
- func (p *Error) Desc() string
- func (p *Error) Error() string
- func (p *Error) ExtraError() error
- func (p *Error) ExtraMessage() string
- func (p *Error) Name() string
- func (p *Error) WithDesc(desc string) *Error
- func (p *Error) WithExtraError(extraError error) *Error
- func (p *Error) WithExtraMessage(extraMessage string) *Error
- func (p *Error) WithName(name string) *Error
- type IError
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Success = NewError(0x0000).WithName("Success").WithDesc("success-成功") Fail = NewError(0x0001).WithName("Fail").WithDesc("fail-失败") NotSupport = NewError(0x0002).WithName("NotSupport").WithDesc("not-support-不支持") Valid = NewError(0x0010).WithName("Valid").WithDesc("valid-有效") Invalid = NewError(0x0011).WithName("Invalid").WithDesc("invalid-无效") Available = NewError(0x0020).WithName("Available").WithDesc("available-可用") Exist = NewError(0x0030).WithName("Exist").WithDesc("exist-存在") NotExist = NewError(0x0031).WithName("NotExist").WithDesc("notExist-不存在") Legal = NewError(0x0040).WithName("Legal").WithDesc("legal-合法") Illegal = NewError(0x0041).WithName("Illegal").WithDesc("illegal-非法") Permitted = NewError(0x0050).WithName("Permitted").WithDesc("permitted-允许的") Prohibited = NewError(0x0051).WithName("Prohibited").WithDesc("prohibited-禁止的") Expect = NewError(0x0060).WithName("Expect").WithDesc("expect-期望") Unexpected = NewError(0x0061).WithName("Unexpected").WithDesc("unexpected-不期望") Enable = NewError(0x0070).WithName("Enable").WithDesc("enable-启用") Disable = NewError(0x0071).WithName("Disable").WithDesc("disable-禁用") Normal = NewError(0x0080).WithName("Normal").WithDesc("normal-正常") Abnormal = NewError(0x0081).WithName("Abnormal").WithDesc("abnormal-异常") NotTimeout = NewError(0x0090).WithName("NotTimeout").WithDesc("not-timeout-未超时") Timeout = NewError(0x0091).WithName("Timeout").WithDesc("timeout-超时") NotOutOfRange = NewError(0x00a0).WithName("NotOutOfRange").WithDesc("not-out-of-range-未超出范围") OutOfRange = NewError(0x00a1).WithName("OutOfRange").WithDesc("out-of-range-超出范围") NotConflict = NewError(0x00b0).WithName("NotConflict").WithDesc("not-conflict-未冲突") Conflict = NewError(0x00b1).WithName("Conflict").WithDesc("conflict-冲突") Matched = NewError(0x00c0).WithName("Matched").WithDesc("matched-匹配") Mismatch = NewError(0x00c1).WithName("Mismatch").WithDesc("mismatch-不匹配") Implemented = NewError(0x00d0).WithName("Implemented").WithDesc("implemented-已实现") NotImplemented = NewError(0x00d1).WithName("NotImplemented").WithDesc("not-implemented-未实现") Registered = NewError(0x00e0).WithName("Registered").WithDesc("registered-已注册") Unregistered = NewError(0x00e1).WithName("Unregistered").WithDesc("unregistered-未注册") Marshal = NewError(0x00f0).WithName("Marshal").WithDesc("marshal-序列化") Unmarshal = NewError(0x00f1).WithName("Unmarshal").WithDesc("unmarshal-反序列化") Level = NewError(0x0100).WithName("Level").WithDesc("level-等级") LevelNotEnough = NewError(0x0101).WithName("LevelNotEnough").WithDesc("level-not-enough-等级不足") NotDuplicate = NewError(0x0110).WithName("NotDuplicate").WithDesc("not-duplicate-不重复") Duplicate = NewError(0x0111).WithName("Duplicate").WithDesc("duplicate-重复") Idle = NewError(0x0120).WithName("Idle").WithDesc("idle-空闲") Busy = NewError(0x0121).WithName("Busy").WithDesc("busy-繁忙") AdequateResources = NewError(0x0130).WithName("AdequateResources").WithDesc("adequate-resources-资源充足") OutOfResources = NewError(0x0131).WithName("OutOfResources").WithDesc("out-of-resources-资源不足") ValidOperation = NewError(0x0140).WithName("ValidOperation").WithDesc("valid-operation-有效操作") InvalidOperation = NewError(0x0141).WithName("InvalidOperation").WithDesc("invalid-operation-无效操作") AdequateCondition = NewError(0x0150).WithName("AdequateCondition").WithDesc("adequate-condition-条件充足") IllConditioned = NewError(0x0151).WithName("IllConditioned").WithDesc("ill-conditioned-条件不足") PermissionGranted = NewError(0x0160).WithName("PermissionGranted").WithDesc("permission-granted-有权限") PermissionDenied = NewError(0x0161).WithName("PermissionDenied").WithDesc("permission-denied-没有权限") NotFrozen = NewError(0x0170).WithName("NotFrozen").WithDesc("not-frozen-未冻结") Frozen = NewError(0x0171).WithName("Frozen").WithDesc("frozen-冻结") Hit = NewError(0x0180).WithName("Hit").WithDesc("hit-命中") Miss = NewError(0x0181).WithName("Miss").WithDesc("miss-未命中") Length = NewError(0x0190).WithName("Length").WithDesc("length-长度") LengthNotEnough = NewError(0x0191).WithName("LengthNotEnough").WithDesc("length-not-enough-数据长度不够,需要继续接收") // 数据长度不够,需要继续接收 Quantity = NewError(0x01a0).WithName("Quantity").WithDesc("quantity-数量") Retry = NewError(0x01b0).WithName("Retry").WithDesc("retry-重试") Link = NewError(0x01c0).WithName("Link").WithDesc("link-链接") System = NewError(0x01d0).WithName("System").WithDesc("system-系统") Param = NewError(0x01e0).WithName("Param").WithDesc("parameter-参数") ParamNotSupport = NewError(0x01e1).WithName("ParamNotSupport").WithDesc("parameter-not-support-参数不支持") ParamCountNotMatch = NewError(0x01e2).WithName("ParamCountNotMatch").WithDesc("parameter-count-not-match-参数数量不匹配") Packet = NewError(0x01f0).WithName("Packet").WithDesc("packet-数据包") Config = NewError(0x0200).WithName("Config").WithDesc("config-配置") Overload = NewError(0x0210).WithName("Overload").WithDesc("overload-过载") Nil = NewError(0x0220).WithName("Nil").WithDesc("nil-空") Format = NewError(0x0230).WithName("Format").WithDesc("format-格式") InterfaceNotMatch = NewError(0x0240).WithName("InterfaceNotMatch").WithDesc("interface-not-match-接口不匹配") NoBehavior = NewError(0x0250).WithName("NoBehavior").WithDesc("no-behavior-没有对应的行为") Disconnect = NewError(0x0260).WithName("Disconnect").WithDesc("disconnect-断开连接") // 协程 GoroutinePanic = NewError(0x0a00).WithName("GoroutinePanic").WithDesc("goroutine-panic-协程-panic") GoroutineDone = NewError(0x0a10).WithName("GoroutineDone").WithDesc("goroutine-done-协程-结束") // 函数 FunctionPanic = NewError(0x0b00).WithName("FunctionPanic").WithDesc("function-panic-函数-panic") FunctionDone = NewError(0x0b10).WithName("FunctionDone").WithDesc("function-done-函数-结束") // channel ChannelFull = NewError(0x0c00).WithName("ChannelFull").WithDesc("channel-full-通道-满") ChannelEmpty = newError(0x0c10).WithName("ChannelEmpty").WithDesc("channel-empty-通道-空") ChannelNotClosed = NewError(0x0c20).WithName("ChannelNotClosed").WithDesc("channel-not-closed-通道-未关闭") ChannelClosed = NewError(0x0c30).WithName("ChannelClosed").WithDesc("channel-closed-通道-已关闭") ChannelNil = NewError(0x0c40).WithName("ChannelNil").WithDesc("channel-通道-未初始化") // grpc GRPCNotFoundShardKey = NewError(0x0d00).WithName("GRPCNotFoundShardKey").WithDesc("grpc-not-found-shard-key-未找到") GRPCInvalidMethod = NewError(0x0d10).WithName("GRPCInvalidMethod").WithDesc("grpc-invalid-method-无效方法") GRPCNotSupportShardKeyType = NewError(0x0d20).WithName("GRPCNotSupportShardKeyType").WithDesc("grpc-not-support-shard-key-type-不支持的shard key类型") GRPCServiceNotFound = NewError(0x0d30).WithName("GRPCServiceNotFound").WithDesc("grpc-service-not-found-服务未找到") // 操作 Insert = NewError(0xf010).WithName("Insert").WithDesc("insert-插入") Find = NewError(0xf020).WithName("Find").WithDesc("find-查找") Update = NewError(0xf030).WithName("Update").WithDesc("update-更新") Delete = NewError(0xf040).WithName("Delete").WithDesc("delete-删除") Send = NewError(0xf050).WithName("Send").WithDesc("send-发送") Receive = NewError(0xf060).WithName("Receive").WithDesc("receive-接收") Configure = NewError(0xf070).WithName("Configure").WithDesc("configure-给配置") Unknown = NewError(0xffff).WithName("Unknown").WithDesc("unknown-未知") )
[系统错误码] lib/error/system 级别的错误码
Functions ¶
func IsNetErrClosing ¶
IsNetErrClosing checks if a network error is due to a closed connection.
func IsNetErrorTimeout ¶
IsNetErrorTimeout checks if a network error is a timeout.
Types ¶
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
func (*Error) ExtraError ¶
func (*Error) ExtraMessage ¶
func (*Error) WithExtraError ¶
func (*Error) WithExtraMessage ¶
Click to show internal directories.
Click to hide internal directories.