PersonalMain-Golang/utility/ErrorCode/ErrorCode.go

33 lines
766 B
Go
Raw Normal View History

2023-12-25 02:19:00 +08:00
package ErrorCode
type ErrorCode struct {
output string
code int
message string
}
type Errors interface {
Output() string
Code() int
Message() string
}
var (
2023-12-25 02:33:27 +08:00
TimestampVerifyFailed = ErrorCode{output: "TimestampVerifyFailed", code: 40010, message: "时间戳格式错误"}
TimestampExpired = ErrorCode{output: "TimestampExpired", code: 40011, message: "时间戳过期"}
TokenExpired = ErrorCode{output: "TokenExpired", code: 40100, message: "Token 已过期"}
TokenVerifyFailed = ErrorCode{output: "TokenVerifyFailed", code: 40101, message: "Token 验证失败"}
2023-12-25 02:19:00 +08:00
)
func (e ErrorCode) Output() string {
return e.output
}
func (e ErrorCode) Code() int {
return e.code
}
func (e ErrorCode) Message() string {
return e.message
}