Documentation
¶
Index ¶
- Constants
- Variables
- func Cause(err error) error
- func Code(err error) int
- func GetCode(code int, dfault string) string
- func Is(err error) bool
- func SetCode(code int, value string)
- func UnWrap(err error) error
- type CauseHolder
- type Error
- func New(code int, casue error, comment string) *Error
- func NewForbidden() *Error
- func NewForbiddenWrap(err error) *Error
- func NewInternalServer() *Error
- func NewInternalServerWrap(err error) *Error
- func NewNotFound() *Error
- func NewNotFoundWrap(err error) *Error
- func NewUnauthorized() *Error
- func NewUnauthorizedWrap(err error) *Error
- func NewUnprocessableEntity() *Error
- func NewUnprocessableEntityWrap(err error) *Error
- func (self *Error) Cause() error
- func (self *Error) Code() int
- func (self *Error) Error() string
- func (self *Error) SetCode(code int) *Error
- func (self *Error) SetComment(comment string) *Error
- func (self *Error) SetCommentf(format string, args ...interface{}) *Error
- func (self *Error) String() string
Constants ¶
View Source
const ( NotFoundMessage = "not found" ForbiddenMessage = "forbidden" InternalServerErrorMessage = "internal server error" UnprocessableMessage = "unprocessable entity" )
Variables ¶
View Source
var DefaultMessageIfEmpty = ""
View Source
var ErrForbiddenCode = 403
View Source
var ErrInternalServerCode = 501
View Source
var ErrNotFoundCode = 404
you can register custom error codes below basic codes
View Source
var ErrUnprocessableEntity = 422
View Source
var UndefinedErrorCode = -1
Functions ¶
Types ¶
type CauseHolder ¶
type CauseHolder interface {
Cause() error
}
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
func NewForbidden ¶
func NewForbidden() *Error
func NewForbiddenWrap ¶
func NewInternalServer ¶
func NewInternalServer() *Error
func NewInternalServerWrap ¶
func NewNotFound ¶
func NewNotFound() *Error
func NewNotFoundWrap ¶
func NewUnauthorized ¶
func NewUnauthorized() *Error
func NewUnauthorizedWrap ¶
func NewUnprocessableEntity ¶
func NewUnprocessableEntity() *Error
func (*Error) SetComment ¶
func (*Error) SetCommentf ¶
Click to show internal directories.
Click to hide internal directories.