feat: incr sync version.
This commit is contained in:
52
go/chao-sdk-core/pkg/sdkerrs/code.go
Normal file
52
go/chao-sdk-core/pkg/sdkerrs/code.go
Normal file
@@ -0,0 +1,52 @@
|
||||
// Copyright © 2023 OpenIM SDK. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package sdkerrs
|
||||
|
||||
// 通用错误码
|
||||
const (
|
||||
NetworkError = 10000
|
||||
NetworkTimeoutError = 10001
|
||||
ArgsError = 10002 //输入参数错误
|
||||
CtxDeadlineExceededError = 10003 //上下文超时
|
||||
|
||||
ResourceLoadNotCompleteError = 10004 //资源初始化未完成
|
||||
UnknownCode = 10005 //没有解析到code
|
||||
SdkInternalError = 10006 //SDK内部错误
|
||||
|
||||
NoUpdateError = 10007 //没有更新
|
||||
|
||||
UserIDNotFoundError = 10100 //UserID不存在 或未注册
|
||||
LoginOutError = 10101 //用户已经退出登录
|
||||
LoginRepeatError = 10102 //用户重复登录
|
||||
|
||||
//消息相关
|
||||
FileNotFoundError = 10200 //记录不存在
|
||||
MsgDeCompressionError = 10201 //消息解压失败
|
||||
MsgDecodeBinaryWsError = 10202 //消息解码失败
|
||||
MsgBinaryTypeNotSupportError = 10203 //消息类型不支持
|
||||
MsgRepeatError = 10204 //消息重复发送
|
||||
MsgContentTypeNotSupportError = 10205 //消息类型不支持
|
||||
MsgHasNoSeqError = 10206 //消息没有seq
|
||||
|
||||
//会话相关
|
||||
NotSupportOptError = 10301 //不支持的操作
|
||||
NotSupportTypeError = 10302 //not support type
|
||||
UnreadCountError = 10303 //unread count has zero
|
||||
|
||||
//群组相关
|
||||
GroupIDNotFoundError = 10400 //GroupID不存在
|
||||
GroupTypeErr = 10401 //群组类型错误
|
||||
|
||||
)
|
||||
26
go/chao-sdk-core/pkg/sdkerrs/error.go
Normal file
26
go/chao-sdk-core/pkg/sdkerrs/error.go
Normal file
@@ -0,0 +1,26 @@
|
||||
// Copyright © 2023 OpenIM SDK. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package sdkerrs
|
||||
|
||||
import "github.com/openimsdk/tools/errs"
|
||||
|
||||
func New(code int, msg string, dtl string) errs.CodeError {
|
||||
return errs.NewCodeError(code, msg).WithDetail(dtl)
|
||||
}
|
||||
|
||||
var (
|
||||
Wrap = errs.Wrap
|
||||
WrapMsg = errs.WrapMsg
|
||||
)
|
||||
50
go/chao-sdk-core/pkg/sdkerrs/predefine.go
Normal file
50
go/chao-sdk-core/pkg/sdkerrs/predefine.go
Normal file
@@ -0,0 +1,50 @@
|
||||
// Copyright © 2023 OpenIM SDK. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package sdkerrs
|
||||
|
||||
import "github.com/openimsdk/tools/errs"
|
||||
|
||||
var (
|
||||
ErrArgs = errs.NewCodeError(ArgsError, "ArgsError")
|
||||
ErrCtxDeadline = errs.NewCodeError(CtxDeadlineExceededError, "CtxDeadlineExceededError")
|
||||
ErrSdkInternal = errs.NewCodeError(SdkInternalError, "SdkInternalError")
|
||||
ErrNetwork = errs.NewCodeError(NetworkError, "NetworkError")
|
||||
ErrNetworkTimeOut = errs.NewCodeError(NetworkTimeoutError, "NetworkTimeoutError")
|
||||
|
||||
ErrGroupIDNotFound = errs.NewCodeError(GroupIDNotFoundError, "GroupIDNotFoundError")
|
||||
ErrUserIDNotFound = errs.NewCodeError(UserIDNotFoundError, "UserIDNotFoundError")
|
||||
|
||||
ErrResourceLoad = errs.NewCodeError(ResourceLoadNotCompleteError, "ResourceLoadNotCompleteError")
|
||||
|
||||
//消息相关
|
||||
ErrFileNotFound = errs.NewCodeError(FileNotFoundError, "RecordNotFoundError")
|
||||
ErrMsgDecodeBinaryWs = errs.NewCodeError(MsgDecodeBinaryWsError, "MsgDecodeBinaryWsError")
|
||||
ErrMsgDeCompression = errs.NewCodeError(MsgDeCompressionError, "MsgDeCompressionError")
|
||||
ErrMsgBinaryTypeNotSupport = errs.NewCodeError(MsgBinaryTypeNotSupportError, "MsgTypeNotSupportError")
|
||||
ErrMsgRepeated = errs.NewCodeError(MsgRepeatError, "only failed message can be repeatedly send")
|
||||
ErrMsgContentTypeNotSupport = errs.NewCodeError(MsgContentTypeNotSupportError, "contentType not support currently") // msg // msg
|
||||
ErrMsgHasNoSeq = errs.NewCodeError(MsgHasNoSeqError, "msg has no seq") // msg // msg
|
||||
|
||||
//会话相关
|
||||
ErrNotSupportOpt = errs.NewCodeError(NotSupportOptError, "super group not support this opt")
|
||||
ErrNotSupportType = errs.NewCodeError(NotSupportTypeError, "only support super group type type")
|
||||
ErrUnreadCount = errs.NewCodeError(UnreadCountError, "unread count has zero")
|
||||
//群组相关
|
||||
|
||||
ErrGroupType = errs.NewCodeError(GroupTypeErr, "group type error")
|
||||
|
||||
ErrLoginOut = errs.NewCodeError(LoginOutError, "LoginOutError")
|
||||
ErrLoginRepeat = errs.NewCodeError(LoginRepeatError, "LoginRepeatError")
|
||||
)
|
||||
Reference in New Issue
Block a user