Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( InternalServerError = CreateErrorFn(http.StatusInternalServerError) Unauthenticated = CreateErrorFn(http.StatusUnauthorized) BadRequest = CreateErrorFn(http.StatusBadRequest) Forbidden = CreateErrorFn(http.StatusForbidden) NotFound = CreateErrorFn(http.StatusNotFound) BadGateway = CreateErrorFn(http.StatusBadGateway) UnprocessableEntity = CreateErrorFn(http.StatusUnprocessableEntity) )
Functions ¶
func CreateErrorFn ¶ added in v0.0.5
Types ¶
type Error ¶
type Error struct {
Status int `json:"-"`
Code string `json:"code,omitempty"`
Message string `json:"message"`
Detail string `json:"detail,omitempty"`
// contains filtered or unexported fields
}
Error is error object.
func GetErrorByStatus ¶
func New ¶
New creates new error object. Example: errors.New("Login failed", "LOGIN_FAILED", "Invalid username or password")
message: error message extras: error detail and error code
func (*Error) MarshalJSON ¶
MarshalJSON is json.Marshaler interface implementation.
Click to show internal directories.
Click to hide internal directories.