Documentation ¶
Overview ¶
Package ginMerry provides the middleware for Gin that pretty-prints the merry errors. If the code is 500 - the error is masked and generic output is retuned to user.
Index ¶
Constants ¶
View Source
const DefaultGenericError = `Internal Server Error!`
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Middleware ¶
type Middleware struct { // Debug controls if a call stack should be printed with every error. // Defaults to false. Debug bool // GenericError is a string that is shown on error code 500 or // non-merry errors. GenericError string // LogFunc is the function that gets called each time an error is occurred. LogFunc func(err string, code int, vals map[string]interface{}) }
Middleware is a handler container for the middleware.
func New ¶
func New(debug bool) *Middleware
New returns new middleware container with default options. If parameter is true then debug mode is assumed.
func (*Middleware) Handler ¶
func (m *Middleware) Handler() gin.HandlerFunc
Handler returns the middleware func.
Click to show internal directories.
Click to hide internal directories.