From 2fc2a3e7827d9033f00425eef78ec9f47d08ebf6 Mon Sep 17 00:00:00 2001 From: "Manu Mtz.-Almeida" Date: Tue, 26 Jan 2016 18:35:04 +0100 Subject: [PATCH] Rendering error throws a panic() --- context.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/context.go b/context.go index 4897fa36..89c925ec 100644 --- a/context.go +++ b/context.go @@ -369,15 +369,10 @@ func (c *Context) GetCookie(name string) (string, error) { func (c *Context) Render(code int, r render.Render) { c.Status(code) if err := r.Render(c.Writer); err != nil { - c.renderError(err) + panic(err) } } -func (c *Context) renderError(err error) { - debugPrintError(err) - c.AbortWithError(500, err).SetType(ErrorTypeRender) -} - // HTML renders the HTTP template specified by its file name. // It also updates the HTTP code and sets the Content-Type as "text/html". // See http://golang.org/doc/articles/wiki/ @@ -399,7 +394,7 @@ func (c *Context) IndentedJSON(code int, obj interface{}) { func (c *Context) JSON(code int, obj interface{}) { c.Status(code) if err := render.WriteJSON(c.Writer, obj); err != nil { - c.renderError(err) + panic(err) } }