Skip to content

Commit

Permalink
Add more error handling to resolve lint-errors
Browse files Browse the repository at this point in the history
Add more error handling to resolve lint-errors
  • Loading branch information
rjan90 committed May 28, 2024
1 parent 5ffb88a commit 8e1c87d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
5 changes: 4 additions & 1 deletion cli/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -2319,7 +2319,10 @@ func OutputDataTransferChannels(out io.Writer, channels []lapi.DataTransferChann
}
}

fmt.Fprintf(out, "Sending Channels\n\n")
if _, err := fmt.Fprintf(out, "Sending Channels\n\n"); err != nil {
fmt.Fprintf(os.Stderr, "Error writing to output: %v\n", err)
return
}
w := tablewriter.New(tablewriter.Col("ID"),
tablewriter.Col("Status"),
tablewriter.Col("Sending To"),
Expand Down
16 changes: 12 additions & 4 deletions cli/multisig.go
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,9 @@ var msigInspectCmd = &cli.Command{
})

w := tabwriter.NewWriter(cctx.App.Writer, 8, 4, 2, ' ', 0)
fmt.Fprintf(w, "ID\tState\tApprovals\tTo\tValue\tMethod\tParams\n")
if _, err := fmt.Fprintf(w, "ID\tState\tApprovals\tTo\tValue\tMethod\tParams\n"); err != nil {
return err
}
for _, txid := range txids {
tx := pending[txid]
target := tx.To.String()
Expand All @@ -344,9 +346,13 @@ var msigInspectCmd = &cli.Command{

if err != nil {
if tx.Method == 0 {
fmt.Fprintf(w, "%d\t%s\t%d\t%s\t%s\t%s(%d)\t%s\n", txid, "pending", len(tx.Approved), target, types.FIL(tx.Value), "Send", tx.Method, paramStr)
if _, err := fmt.Fprintf(w, "%d\t%s\t%d\t%s\t%s\t%s(%d)\t%s\n", txid, "pending", len(tx.Approved), target, types.FIL(tx.Value), "Send", tx.Method, paramStr); err != nil {
return err
}
} else {
fmt.Fprintf(w, "%d\t%s\t%d\t%s\t%s\t%s(%d)\t%s\n", txid, "pending", len(tx.Approved), target, types.FIL(tx.Value), "new account, unknown method", tx.Method, paramStr)
if _, err := fmt.Fprintf(w, "%d\t%s\t%d\t%s\t%s\t%s(%d)\t%s\n", txid, "pending", len(tx.Approved), target, types.FIL(tx.Value), "new account, unknown method", tx.Method, paramStr); err != nil {
return err
}
}
} else {
method := consensus.NewActorRegistry().Methods[targAct.Code][tx.Method] // TODO: use remote map
Expand All @@ -365,7 +371,9 @@ var msigInspectCmd = &cli.Command{
paramStr = string(b)
}

fmt.Fprintf(w, "%d\t%s\t%d\t%s\t%s\t%s(%d)\t%s\n", txid, "pending", len(tx.Approved), target, types.FIL(tx.Value), method.Name, tx.Method, paramStr)
if _, err := fmt.Fprintf(w, "%d\t%s\t%d\t%s\t%s\t%s(%d)\t%s\n", txid, "pending", len(tx.Approved), target, types.FIL(tx.Value), method.Name, tx.Method, paramStr); err != nil {
return err
}
}
}
if err := w.Flush(); err != nil {
Expand Down

0 comments on commit 8e1c87d

Please sign in to comment.