From d3f4c816c7a76ef71cbc6363294a6510db90a231 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Sun, 21 Aug 2016 18:07:13 +0200 Subject: [PATCH] Print error stack if available --- src/cmds/restic/main.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/cmds/restic/main.go b/src/cmds/restic/main.go index f9a4ec808..271ba0e41 100644 --- a/src/cmds/restic/main.go +++ b/src/cmds/restic/main.go @@ -8,6 +8,7 @@ import ( "runtime" "github.com/jessevdk/go-flags" + "github.com/pkg/errors" ) func init() { @@ -37,10 +38,11 @@ func main() { } if err != nil { - fmt.Fprintf(os.Stderr, "%v\n", err) + debug.Log("main", "command returned error: %#v", err) + fmt.Fprintf(os.Stderr, "%+v\n", err) } - if restic.IsAlreadyLocked(err) { + if restic.IsAlreadyLocked(errors.Cause(err)) { fmt.Fprintf(os.Stderr, "\nthe `unlock` command can be used to remove stale locks\n") }