Преглед на файлове

添加数据异常错误码

yjp преди 2 години
родител
ревизия
30a0b963ac
променени са 1 файла, в които са добавени 6 реда и са изтрити 0 реда
  1. 6 0
      errors.go

+ 6 - 0
errors.go

@@ -13,6 +13,7 @@ const (
 	ErrNotExistCode     uint32 = 0x00000004
 	ErrTypeTransferCode uint32 = 0x00000005
 	ErrAuthCode         uint32 = 0x00000006
+	ErrDataCode         uint32 = 0x00000007
 	ErrCustomCode       uint32 = 0x00001000
 )
 
@@ -23,6 +24,7 @@ var codeMap = map[uint32]string{
 	ErrNotExistCode:     "资源不存在",
 	ErrTypeTransferCode: "类型转换错误",
 	ErrAuthCode:         "鉴权错误",
+	ErrDataCode:         "数据异常",
 	ErrCustomCode:       "自定义错误",
 }
 
@@ -68,6 +70,10 @@ func NewAuthError(message string) *Error {
 	return newError(ErrAuthCode, message)
 }
 
+func NewDataError(message string) *Error {
+	return newError(ErrDataCode, message)
+}
+
 func NewCustomError(message string) *Error {
 	return newError(ErrCustomCode, message)
 }