提交 54904a76 作者: Kevin Atkinson

Rename streamResults to streamResult.

License: MIT
Signed-off-by: 's avatarKevin Atkinson <k@kevina.org>
上级 7edc7de2
......@@ -84,7 +84,7 @@ The optional format string is a printf style format string:
return emitCids(req, resp, opts)
},
PostRun: cmds.PostRunMap{
cmds.CLI: streamResults(func(v interface{}, out io.Writer) nonFatalError {
cmds.CLI: streamResult(func(v interface{}, out io.Writer) nonFatalError {
r := v.(*CidFormatRes)
if r.ErrorMsg != "" {
return nonFatalError(fmt.Sprintf("%s: %s", r.CidStr, r.ErrorMsg))
......
......@@ -153,10 +153,10 @@ func unwrapOutput(i interface{}) (interface{}, error) {
type nonFatalError string
// streamResults is a helper function to stream results that possibly
// streamResult is a helper function to stream results that possibly
// contain non-fatal errors. The helper function is allowed to panic
// on internal errors.
func streamResults(procVal func(interface{}, io.Writer) nonFatalError) func(cmds.Response, cmds.ResponseEmitter) error {
func streamResult(procVal func(interface{}, io.Writer) nonFatalError) func(cmds.Response, cmds.ResponseEmitter) error {
return func(res cmds.Response, re cmds.ResponseEmitter) (err error) {
defer func() {
if r := recover(); r != nil {
......
......@@ -72,7 +72,7 @@ The output is:
return res.Emit(out)
},
PostRun: cmds.PostRunMap{
cmds.CLI: streamResults(func(v interface{}, out io.Writer) nonFatalError {
cmds.CLI: streamResult(func(v interface{}, out io.Writer) nonFatalError {
r := v.(*filestore.ListRes)
if r.ErrorMsg != "" {
return nonFatalError(r.ErrorMsg)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论