library-go/errs/code/code.go

75 lines
2.0 KiB
Go
Raw Permalink Normal View History

2024-08-27 13:52:33 +00:00
package code
const (
OK uint32 = 0
)
// 詳細代碼 - 輸入類 01x
const (
_ = iota + CatInput
InvalidFormat // 無效格式
NotValidImplementation // 非有效實現
InvalidRange // 無效範圍
)
// 詳細代碼 - 資料庫類 02x
const (
_ = iota + CatDB
DBError // 資料庫一般錯誤
DBDataConvert // 資料轉換錯誤
DBDuplicate // 資料重複
)
// 詳細代碼 - 資源類 03x
const (
_ = iota + CatResource
ResourceNotFound // 資源未找到
InvalidResourceFormat // 無效的資源格式
ResourceAlreadyExist // 資源已存在
ResourceInsufficient // 資源不足
InsufficientPermission // 權限不足
InvalidMeasurementID // 無效的測量ID
ResourceExpired // 資源過期
ResourceMigrated // 資源已遷移
InvalidResourceState // 無效的資源狀態
InsufficientQuota // 配額不足
ResourceHasMultiOwner // 資源有多個所有者
)
/* 詳細代碼 - GRPC */
// GRPC 的詳細代碼使用 Go GRPC 的內建代碼。
// 參考 "google.golang.org/grpc/codes" 獲取更多詳細資訊。
// 詳細代碼 - 驗證類 05x
const (
_ = iota + CatAuth
Unauthorized // 未授權
AuthExpired // 授權過期
InvalidPosixTime // 無效的 POSIX 時間
SigAndPayloadNotMatched // 簽名和載荷不匹配
Forbidden // 禁止訪問
)
// 詳細代碼 - 系統類 06x
const (
_ = iota + CatSystem
SystemInternalError // 系統內部錯誤
SystemMaintainError // 系統維護錯誤
SystemTimeoutError // 系統超時錯誤
)
// 詳細代碼 - PubSub 07x
const (
_ = iota + CatPubSub
Publish // 發佈錯誤
Consume // 消費錯誤
MsgSizeTooLarge // 訊息過大
)
// 詳細代碼 - 特定服務類 08x
const (
_ = iota + CatService
ArkInternal // Ark 內部錯誤
ArkHTTP400 // Ark HTTP 400 錯誤
)