diff --git a/cmd/ipfs2/tour.go b/cmd/ipfs2/tour.go index bbc1ed1c1..da0d6f422 100644 --- a/cmd/ipfs2/tour.go +++ b/cmd/ipfs2/tour.go @@ -53,7 +53,7 @@ IPFS very quickly. To start, run: t, err := tourGet(id) if err != nil { - return nil, err + return nil, cmds.ClientError(err.Error()) } err = tourShow(out, t) diff --git a/commands/command.go b/commands/command.go index 0301e9d1b..5e031338e 100644 --- a/commands/command.go +++ b/commands/command.go @@ -65,9 +65,9 @@ type Command struct { } // ErrNotCallable signals a command that cannot be called. -var ErrNotCallable = errors.New("This command can't be called directly. Try one of its subcommands.") +var ErrNotCallable = ClientError("This command can't be called directly. Try one of its subcommands.") -var ErrNoFormatter = errors.New("This command cannot be formatted to plain text") +var ErrNoFormatter = ClientError("This command cannot be formatted to plain text") var ErrIncorrectType = errors.New("The command returned a value with a different type than expected") @@ -276,3 +276,7 @@ func checkArgValue(v interface{}, def Argument) error { return nil } + +func ClientError(msg string) error { + return &Error{Code: ErrClient, Message: msg} +}