Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrDatabase = errors.New("Database error")
ErrDatabase is a generic database error
View Source
var ErrDatabaseNotFound = errors.New("Database not found")
ErrDatabaseNotFound is the error meant for when the database doesn't exist
View Source
var ErrDatabaseRelationNotFound = errors.New("Relation not found")
ErrDatabaseRelationNotFound is the error meant for when a table doesn't exist
View Source
var ErrMarshal = errors.New("Could not marshal struct into JSON")
ErrMarshal is the error thrown when marshalling fails
View Source
var ErrNotFound = &ErrorResponse{
HTTPStatusCode: 404,
Status: "failure",
Message: "resource not found",
}
ErrNotFound is a predefined 404 error
Functions ¶
func ErrInternalServer ¶
ErrInternalServer returns a generic server error
func ErrInvalidRequest ¶
ErrInvalidRequest indicates that the request was invalid
Types ¶
type ErrorResponse ¶
type ErrorResponse struct {
Error error `json:"-"` // low level runtime err
HTTPStatusCode int `json:"-"` // http status code
Message string `json:"message"` // high level status message
Status string `json:"status"` // status message (success | failure)
ErrorCode int `json:"code,omitempty"` // application level error code
ErrorText string `json:"error,omitempty"` // application level error message
}
ErrorResponse represents the error response object
func (*ErrorResponse) Render ¶
func (err *ErrorResponse) Render(w http.ResponseWriter, r *http.Request) error
Render is the error response renderer
Click to show internal directories.
Click to hide internal directories.