package httphandlers

import (
	"github.com/gin-gonic/gin"
	"github.com/pufferpanel/pufferd/logging"
	"runtime/debug"
)

func Recovery() gin.HandlerFunc {
	return func(c *gin.Context) {
		defer func() {
			if err := recover(); err != nil {
				c.Status(500)
				logging.Errorf("Error handling route\n%+v\n%s", err, debug.Stack())
			}
		}()

		c.Next();
	}
}
package httphandlers

import (
	"github.com/gin-gonic/gin"
	"github.com/pufferpanel/pufferd/logging"
)

func Recovery() gin.HandlerFunc {
	return func(c *gin.Context) {
		defer func() {
			if err := recover(); err != nil {
				logging.Errorf("Error handling route\n%+v", err)
			}
		}()

		c.Next();
	}
}
--- 
+++ 
@@ -3,13 +3,15 @@
 import (
 	"github.com/gin-gonic/gin"
 	"github.com/pufferpanel/pufferd/logging"
+	"runtime/debug"
 )
 
 func Recovery() gin.HandlerFunc {
 	return func(c *gin.Context) {
 		defer func() {
 			if err := recover(); err != nil {
-				logging.Errorf("Error handling route\n%+v", err)
+				c.Status(500)
+				logging.Errorf("Error handling route\n%+v\n%s", err, debug.Stack())
 			}
 		}()
 
Improve logging to print stacktrace on error
