Catch and log panic in blockbook main

pull/197/head
Martin Boehm 2019-06-11 16:27:47 +02:00
parent c4487ac94b
commit d5f11561ac
3 changed files with 10 additions and 2 deletions

View File

@ -15,6 +15,7 @@ import (
_ "net/http/pprof"
"os"
"os/signal"
"runtime/debug"
"strings"
"sync/atomic"
"syscall"
@ -105,6 +106,13 @@ func init() {
}
func main() {
defer func() {
if e := recover(); e != nil {
glog.Error("main recovered from panic: ", e)
debug.PrintStack()
os.Exit(-1)
}
}()
os.Exit(mainWithExitCode())
}