You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
831 B
37 lines
831 B
package errors
|
|
|
|
import "errors"
|
|
|
|
// 业务错误定义
|
|
|
|
var (
|
|
// 参数错误
|
|
ErrInvalidParam = errors.New("参数错误")
|
|
ErrInvalidSymbol = errors.New("无效的标的代码")
|
|
ErrInvalidDate = errors.New("无效的日期格式")
|
|
|
|
// 数据错误
|
|
ErrSymbolNotFound = errors.New("标的不存在")
|
|
ErrDataNotFound = errors.New("数据不存在")
|
|
ErrDataSourceUnavailable = errors.New("数据源不可用")
|
|
|
|
// 权限错误
|
|
ErrUnauthorized = errors.New("未授权")
|
|
ErrRateLimit = errors.New("请求过于频繁")
|
|
|
|
// 系统错误
|
|
ErrInternal = errors.New("服务器内部错误")
|
|
)
|
|
|
|
// ErrorCode 错误码
|
|
type ErrorCode int
|
|
|
|
const (
|
|
CodeOK ErrorCode = 0
|
|
CodeBadRequest ErrorCode = 400
|
|
CodeUnauthorized ErrorCode = 401
|
|
CodeNotFound ErrorCode = 404
|
|
CodeRateLimit ErrorCode = 429
|
|
CodeInternal ErrorCode = 500
|
|
)
|