提交 c4365862 作者: Overbool 提交者: Steven Allen

commands/filestore: print StatusOtherError error

License: MIT
Signed-off-by: 's avatarOverbool <overbool.xu@gmail.com>
上级 2462bf91
...@@ -3,6 +3,7 @@ package commands ...@@ -3,6 +3,7 @@ package commands
import ( import (
"fmt" "fmt"
"io" "io"
"os"
core "github.com/ipfs/go-ipfs/core" core "github.com/ipfs/go-ipfs/core"
cmdenv "github.com/ipfs/go-ipfs/core/commands/cmdenv" cmdenv "github.com/ipfs/go-ipfs/core/commands/cmdenv"
...@@ -150,7 +151,7 @@ For ERROR entries the error will also be printed to stderr. ...@@ -150,7 +151,7 @@ For ERROR entries the error will also be printed to stderr.
Encoders: cmds.EncoderMap{ Encoders: cmds.EncoderMap{
cmds.Text: cmds.MakeTypedEncoder(func(req *cmds.Request, w io.Writer, out *filestore.ListRes) error { cmds.Text: cmds.MakeTypedEncoder(func(req *cmds.Request, w io.Writer, out *filestore.ListRes) error {
if out.Status == filestore.StatusOtherError { if out.Status == filestore.StatusOtherError {
return fmt.Errorf(out.ErrorMsg) fmt.Fprintf(os.Stderr, "%s\n", out.ErrorMsg)
} }
fmt.Fprintf(w, "%s %s\n", out.Status.Format(), out.FormatLong()) fmt.Fprintf(w, "%s %s\n", out.Status.Format(), out.FormatLong())
return nil return nil
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论