Documentation
¶
Index ¶
- func BuildMetaCode(mainCode, subCode int) int
- func IsAPIError(err error) bool
- func RespError(c *gin.Context, err APIError)
- func RespOK(c *gin.Context, ok APIOK)
- type APIError
- func NewBadRequestError(subCode int, err error) APIError
- func NewConflictError(subCode int, err error) APIError
- func NewForbiddenError(subCode int, err error) APIError
- func NewInternalError(subCode int, err error) APIError
- func NewNotFoundError(subCode int, err error) APIError
- func NewServiceUnavailableError(subCode int, err error) APIError
- func NewUnauthorizedError(subCode int, err error) APIError
- func NewUnprocessableEntityError(subCode int, err error) APIError
- type APIOK
- type BaseAPIError
- type OK
- type RespBody
- type RespMeta
- type StatusCodeDescription
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildMetaCode ¶
func IsAPIError ¶
Types ¶
type APIError ¶
type APIError interface { MainCode() int SubCode() int Type() string Message() string Error() string }
func NewServiceUnavailableError ¶
503
func NewUnauthorizedError ¶
401 Unauthorized
func NewUnprocessableEntityError ¶
422
type APIOK ¶
type BaseAPIError ¶
type BaseAPIError struct {
// contains filtered or unexported fields
}
func (*BaseAPIError) Error ¶
func (c *BaseAPIError) Error() string
func (*BaseAPIError) MainCode ¶
func (c *BaseAPIError) MainCode() int
func (*BaseAPIError) Message ¶
func (c *BaseAPIError) Message() string
func (*BaseAPIError) SubCode ¶
func (c *BaseAPIError) SubCode() int
func (*BaseAPIError) Type ¶
func (c *BaseAPIError) Type() string
type StatusCodeDescription ¶
Click to show internal directories.
Click to hide internal directories.