Output full stacktrace for errors when debugging

This commit is contained in:
Tobie Morgan Hitchcock 2017-02-09 20:55:13 +00:00
parent 7f0ea653b8
commit 2a35485089

View file

@ -20,6 +20,8 @@ import (
"net/http" "net/http"
"runtime/debug"
"github.com/abcum/fibre" "github.com/abcum/fibre"
"github.com/abcum/surreal/cnf" "github.com/abcum/surreal/cnf"
"github.com/abcum/surreal/kvs" "github.com/abcum/surreal/kvs"
@ -196,7 +198,8 @@ func (e *executor) execute(quit <-chan bool, send chan<- *Response) {
defer func() { defer func() {
if r := recover(); r != nil { if r := recover(); r != nil {
if err, ok := r.(error); ok { if err, ok := r.(error); ok {
fmt.Println(err) log.WithPrefix("db").Errorln(err)
log.WithPrefix("db").Debugln(string(debug.Stack()))
} }
} }
}() }()