Documentation ¶
Index ¶
Constants ¶
View Source
const ( FormattingError = 10001 HasRegistered = 10002 NotRegistered = 10003 PasswordErr = 10004 GetIMTokenErr = 10005 RepeatSendCode = 10006 MailSendCodeErr = 10007 SmsSendCodeErr = 10008 CodeInvalidOrExpired = 10009 RegisterFailed = 10010 ResetPasswordFailed = 10011 RegisterLimit = 10012 LoginLimit = 10013 InvitationError = 10014 )
View Source
const ( NoError = 0 // 无错误 DatabaseError = 90002 // redis/mysql等db错误 NetworkError = 90004 // 网络错误 DataError = 90007 // 数据错误 CallbackError = 80000 // 通用错误码. ServerInternalError = 500 // 服务器内部错误 ArgsError = 1001 // 输入参数错误 NoPermissionError = 1002 // 权限不足 DuplicateKeyError = 1003 RecordNotFoundError = 1004 // 记录不存在 // 账号错误码. UserIDNotFoundError = 1101 // UserID不存在 或未注册 RegisteredAlreadyError = 1102 // 用户已经注册过了 // 群组错误码. GroupIDNotFoundError = 1201 // GroupID不存在 GroupIDExisted = 1202 // GroupID已存在 NotInGroupYetError = 1203 // 不在群组中 DismissedAlreadyError = 1204 // 群组已经解散 GroupTypeNotSupport = 1205 GroupRequestHandled = 1206 // 关系链错误码. CanNotAddYourselfError = 1301 // 不能添加自己为好友 BlockedByPeer = 1302 // 被对方拉黑 NotPeersFriend = 1303 // 不是对方的好友 RelationshipAlreadyError = 1304 // 已经是好友关系 // 消息错误码. MessageHasReadDisable = 1401 MutedInGroup = 1402 // 群成员被禁言 MutedGroup = 1403 // 群被禁言 MsgAlreadyRevoke = 1404 // 消息已撤回 // token错误码. TokenExpiredError = 1501 TokenInvalidError = 1502 TokenMalformedError = 1503 TokenNotValidYetError = 1504 TokenUnknownError = 1505 TokenKickedError = 1506 TokenNotExistError = 1507 // 长连接网关错误码. ConnOverMaxNumLimit = 1601 ConnArgsErr = 1602 PushMsgErr = 1603 IOSBackgroundPushErr = 1604 // S3错误码. FileUploadedExpiredError = 1701 // 上传过期 )
通用错误码.
View Source
const UnknownCode = 1000
UnknownCode 没有解析到code或解析的code=0.
Variables ¶
View Source
var ( ErrArgs = NewCodeError(ArgsError, "ArgsError") ErrNoPermission = NewCodeError(NoPermissionError, "NoPermissionError") ErrDatabase = NewCodeError(DatabaseError, "DatabaseError") ErrInternalServer = NewCodeError(ServerInternalError, "ServerInternalError") ErrNetwork = NewCodeError(NetworkError, "NetworkError") ErrCallback = NewCodeError(CallbackError, "CallbackError") ErrCallbackContinue = NewCodeError(CallbackError, "ErrCallbackContinue") ErrUserIDNotFound = NewCodeError(UserIDNotFoundError, "UserIDNotFoundError") ErrGroupIDNotFound = NewCodeError(GroupIDNotFoundError, "GroupIDNotFoundError") ErrGroupIDExisted = NewCodeError(GroupIDExisted, "GroupIDExisted") ErrRecordNotFound = NewCodeError(RecordNotFoundError, "RecordNotFoundError") ErrNotInGroupYet = NewCodeError(NotInGroupYetError, "NotInGroupYetError") ErrDismissedAlready = NewCodeError(DismissedAlreadyError, "DismissedAlreadyError") ErrRegisteredAlready = NewCodeError(RegisteredAlreadyError, "RegisteredAlreadyError") ErrGroupTypeNotSupport = NewCodeError(GroupTypeNotSupport, "") ErrGroupRequestHandled = NewCodeError(GroupRequestHandled, "GroupRequestHandled") ErrData = NewCodeError(DataError, "DataError") ErrTokenExpired = NewCodeError(TokenExpiredError, "TokenExpiredError") ErrTokenInvalid = NewCodeError(TokenInvalidError, "TokenInvalidError") // ErrTokenMalformed = NewCodeError(TokenMalformedError, "TokenMalformedError") // ErrTokenNotValidYet = NewCodeError(TokenNotValidYetError, "TokenNotValidYetError") // ErrTokenUnknown = NewCodeError(TokenUnknownError, "TokenUnknownError") // ErrTokenKicked = NewCodeError(TokenKickedError, "TokenKickedError") ErrTokenNotExist = NewCodeError(TokenNotExistError, "TokenNotExistError") // ErrDuplicateKey = NewCodeError(DuplicateKeyError, "DuplicateKeyError") ErrMessageHasReadDisable = NewCodeError(MessageHasReadDisable, "MessageHasReadDisable") ErrCanNotAddYourself = NewCodeError(CanNotAddYourselfError, "CanNotAddYourselfError") ErrBlockedByPeer = NewCodeError(BlockedByPeer, "BlockedByPeer") ErrNotPeersFriend = NewCodeError(NotPeersFriend, "NotPeersFriend") ErrRelationshipAlready = NewCodeError(RelationshipAlreadyError, "RelationshipAlreadyError") ErrMutedInGroup = NewCodeError(MutedInGroup, "MutedInGroup") ErrMutedGroup = NewCodeError(MutedGroup, "MutedGroup") ErrMsgAlreadyRevoke = NewCodeError(MsgAlreadyRevoke, "MsgAlreadyRevoke") ErrConnOverMaxNumLimit = NewCodeError(ConnOverMaxNumLimit, "ConnOverMaxNumLimit") ErrConnArgsErr = NewCodeError(ConnArgsErr, "args err, need token, sendID, platformID") ErrPushMsgErr = NewCodeError(PushMsgErr, "push msg err") ErrIOSBackgroundPushErr = NewCodeError(IOSBackgroundPushErr, "ios background push err") ErrFileUploadedExpired = NewCodeError(FileUploadedExpiredError, "FileUploadedExpiredError") )
View Source
var Relation = &relation{m: make(map[int]map[int]struct{})}
Functions ¶
Types ¶
type CodeError ¶
type CodeError interface { Code() int Msg() string Detail() string WithDetail(detail string) CodeError // Is checks if the error is of a certain type, when loose is false, //only the error code is the same is considered the same error, default is true Is(err error, loose ...bool) bool Wrap() error WrapMsg(msg string, kv ...any) error error }
func NewCodeError ¶
Click to show internal directories.
Click to hide internal directories.