mirror of
https://github.com/offen/docker-volume-backup.git
synced 2024-11-25 06:30:29 +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 (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"runtime/debug"
|
||||||
|
|
||||||
"github.com/offen/docker-volume-backup/internal/errwrap"
|
"github.com/offen/docker-volume-backup/internal/errwrap"
|
||||||
)
|
)
|
||||||
@ -17,6 +18,7 @@ import (
|
|||||||
func runScript(c *Config) (err error) {
|
func runScript(c *Config) (err error) {
|
||||||
defer func() {
|
defer func() {
|
||||||
if derr := recover(); derr != nil {
|
if derr := recover(); derr != nil {
|
||||||
|
fmt.Printf("%s: %s\n", derr, debug.Stack())
|
||||||
asErr, ok := derr.(error)
|
asErr, ok := derr.(error)
|
||||||
if ok {
|
if ok {
|
||||||
err = errwrap.Wrap(asErr, "unexpected panic running script")
|
err = errwrap.Wrap(asErr, "unexpected panic running script")
|
||||||
|
Loading…
Reference in New Issue
Block a user