Skip to content

Commit

Permalink
address stebalien's comments
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: keks <keks@cryptoscope.co>
  • Loading branch information
keks committed Sep 18, 2018
1 parent 108274e commit 1eb7ddf
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion cmd/ipfs/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
9 changes: 6 additions & 3 deletions core/commands/files.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
}
}
}()

Expand Down
4 changes: 1 addition & 3 deletions core/commands/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 1 addition & 2 deletions core/commands/urlstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 1eb7ddf

Please sign in to comment.