diff --git a/gin.go b/gin.go index a06c13a5..00b1fb65 100644 --- a/gin.go +++ b/gin.go @@ -327,6 +327,14 @@ func (c *Context) Fail(code int, err error) { c.Abort(code) } +// Dump is the same as Fail except instead of an error +// you are able to dump out any data that you may need to +// trouble shoot for your application. +func (c *Context) Dump(code int, dump interface) { + c.Writer.Write([]byte(fmt.Sprint("%v", dump))) + c.Abort(code) +} + func (c *Context) ErrorTyped(err error, typ uint32, meta interface{}) { c.Errors = append(c.Errors, errorMsg{ Err: err.Error(),