mirror of
https://github.com/offen/docker-volume-backup.git
synced 2024-11-21 21:10:26 +01:00
Print stack trace when encountering unexpected panic (#406)
This commit is contained in:
parent
8b69566291
commit
f2ef48803c
@ -6,6 +6,7 @@ package main
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"runtime/debug"
|
||||
|
||||
"github.com/offen/docker-volume-backup/internal/errwrap"
|
||||
)
|
||||
@ -17,6 +18,7 @@ import (
|
||||
func runScript(c *Config) (err error) {
|
||||
defer func() {
|
||||
if derr := recover(); derr != nil {
|
||||
fmt.Printf("%s: %s\n", derr, debug.Stack())
|
||||
asErr, ok := derr.(error)
|
||||
if ok {
|
||||
err = errwrap.Wrap(asErr, "unexpected panic running script")
|
||||
|
Loading…
Reference in New Issue
Block a user