[main] Try to catch panics and print them without stacktraces.

This commit is contained in:
Ciprian Dorin Craciun 2021-12-15 19:57:24 +02:00
parent b691f48e80
commit 14183379b6

View file

@ -14,7 +14,13 @@ import "os"
func Main_0 (_main func () (error)) () {
log.SetFlags (0)
log.SetPrefix (fmt.Sprintf ("[%8d] ", os.Getpid ()))
defer func () () {
if _panic := recover (); _panic != nil {
log.Printf ("[ee] [279a6e2e] %s\n", _panic)
AbortError (nil, "[5bcae27c] unexpected panic!")
}
} ()
if _error := _main (); _error == nil {
os.Exit (0)