1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-05-21 08:56:37 +08:00

address stebalien's comments

License: MIT
Signed-off-by: keks <keks@cryptoscope.co>
This commit is contained in:
keks
2018-09-18 15:21:03 +02:00
committed by Steven Allen
parent 08cc8552e2
commit 74ec1a9aef
4 changed files with 9 additions and 9 deletions

View File

@ -188,7 +188,7 @@ func daemonFunc(req *cmds.Request, re cmds.ResponseEmitter, env cmds.Environment
// Inject metrics before we do anything
err := mprome.Inject()
if err != nil {
return fmt.Errorf("Injecting prometheus handler for metrics failed with message %s", err.Error())
log.Errorf("Injecting prometheus handler for metrics failed with message: %s\n", err.Error())
}
// let the user know we're going.

View File

@ -112,7 +112,6 @@ var filesStatCmd = &cmds.Command{
_, err := statGetFormatOptions(req)
if err != nil {
// REVIEW NOTE: We didn't return here before, was that correct?
return cmdkit.Errorf(cmdkit.ErrClient, err.Error())
}
@ -725,7 +724,7 @@ stat' on the file or any of its ancestors.
cidVersionOption,
hashOption,
},
Run: func(req *cmds.Request, re cmds.ResponseEmitter, env cmds.Environment) error {
Run: func(req *cmds.Request, re cmds.ResponseEmitter, env cmds.Environment) (retErr error) {
path, err := checkPath(req.Arguments[0])
if err != nil {
return err
@ -775,7 +774,11 @@ stat' on the file or any of its ancestors.
defer func() {
err := wfd.Close()
if err != nil {
re.CloseWithError(cmdkit.Errorf(cmdkit.ErrNormal, err.Error()))
if retErr == nil {
retErr = err
} else {
log.Error("files: error closing file mfs file descriptor", err)
}
}
}()

View File

@ -103,9 +103,7 @@ may also specify the level of compression by specifying '-l=<1-9>'.
outReader, ok := v.(io.Reader)
if !ok {
// TODO or just return the error here?
log.Error(e.New(e.TypeErr(outReader, v)))
return nil
return e.New(e.TypeErr(outReader, v))
}
outPath := getOutPath(req)

View File

@ -107,11 +107,10 @@ time.
return err
}
err = cmds.EmitOnce(res, &BlockStat{
return cmds.EmitOnce(res, &BlockStat{
Key: root.Cid().String(),
Size: int(hres.ContentLength),
})
return err
},
Encoders: cmds.EncoderMap{
cmds.Text: cmds.MakeTypedEncoder(func(req *cmds.Request, w io.Writer, bs *BlockStat) error {