Print error stack if available

This commit is contained in:
Alexander Neumann 2016-08-21 18:07:13 +02:00
parent 72aa6be38d
commit d3f4c816c7
1 changed files with 4 additions and 2 deletions

View File

@ -8,6 +8,7 @@ import (
"runtime" "runtime"
"github.com/jessevdk/go-flags" "github.com/jessevdk/go-flags"
"github.com/pkg/errors"
) )
func init() { func init() {
@ -37,10 +38,11 @@ func main() {
} }
if err != nil { 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") fmt.Fprintf(os.Stderr, "\nthe `unlock` command can be used to remove stale locks\n")
} }