properly log unhandled panics.
This commit is contained in:
parent
6b39e8e0e8
commit
b49f545094
1 changed files with 8 additions and 0 deletions
|
|
@ -20,6 +20,14 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func Execute() error {
|
func Execute() error {
|
||||||
|
// properly log unhandled panics
|
||||||
|
defer func() {
|
||||||
|
panicVal := recover()
|
||||||
|
if panicVal != nil {
|
||||||
|
log.Panic().Msgf("%v", panicVal)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
return root.Execute()
|
return root.Execute()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue