Skip to content

Commit

Permalink
Merge pull request #393 from jhkimqd/jihwan/monitor-silence-usage
Browse files Browse the repository at this point in the history
feat: silence usage when error returned for monitor
  • Loading branch information
jhkimqd authored Oct 7, 2024
2 parents d97cc5b + 86f5fb7 commit 989b4a2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions cmd/monitor/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,11 @@ func (s *SafeBatchSize) Auto() bool {
}

var MonitorCmd = &cobra.Command{
Use: "monitor",
Short: "Monitor blocks using a JSON-RPC endpoint.",
Long: usage,
Args: cobra.NoArgs,
Use: "monitor",
Short: "Monitor blocks using a JSON-RPC endpoint.",
Long: usage,
Args: cobra.NoArgs,
SilenceUsage: true,
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
// By default, hide logs from `polycli monitor`.
verbosityFlag := cmd.Flag("verbosity")
Expand Down
2 changes: 1 addition & 1 deletion cmd/monitor/monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ func monitor(ctx context.Context) error {
for {
err = fetchCurrentBlockData(ctx, ec, ms, isUiRendered)
if err != nil {
log.Error().Msg(fmt.Sprintf("Error: %v", err))
log.Error().Msg(fmt.Sprintf("Error: unable to fetch current block data: %v", err))
// Send the error to the errChan channel to return.
errChan <- err
return
Expand Down

0 comments on commit 989b4a2

Please sign in to comment.