mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-14 20:22:20 +08:00
Proposed Dump function.
This commit is contained in:
parent
c224bf8211
commit
8419489349
8
gin.go
8
gin.go
@ -327,6 +327,14 @@ func (c *Context) Fail(code int, err error) {
|
|||||||
c.Abort(code)
|
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{}) {
|
func (c *Context) ErrorTyped(err error, typ uint32, meta interface{}) {
|
||||||
c.Errors = append(c.Errors, errorMsg{
|
c.Errors = append(c.Errors, errorMsg{
|
||||||
Err: err.Error(),
|
Err: err.Error(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user