Documentation
¶
Index ¶
- func IsBadRequest(err error) bool
- func IsInternalServer(err error) bool
- func IsNotFound(err error) bool
- type Error
- func BadRequest(reason, message string) *Error
- func Conflict(reason, message string) *Error
- func Forbidden(reason, message string) *Error
- func FromError(err error) *Error
- func InternalServer(reason, message string) *Error
- func New(code int32, reason, message string) *Error
- func NotFound(reason, message string) *Error
- func ServiceUnavailable(reason, message string) *Error
- func TooManyRequests(reason, message string) *Error
- func Unauthorized(reason, message string) *Error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsInternalServer ¶
IsInternalServer 检查是否为InternalServer错误
Types ¶
type Error ¶
type Error struct {
Code int32 `json:"code"`
Reason string `json:"reason"`
Message string `json:"message"`
Metadata map[string]string `json:"metadata"`
}
Error 是Cosmos框架的错误类型
func InternalServer ¶
InternalServer 返回HTTP 500错误
func ServiceUnavailable ¶
ServiceUnavailable 返回HTTP 503错误
func TooManyRequests ¶
TooManyRequests 返回HTTP 429错误
Click to show internal directories.
Click to hide internal directories.