From 8107d2723665b6a8b5c49c2bc6068cb3c4d07212 Mon Sep 17 00:00:00 2001 From: Ji Hwan Date: Mon, 7 Oct 2024 20:02:04 +0900 Subject: [PATCH 1/2] feat: silence usage when error returned for monitor Signed-off-by: Ji Hwan --- cmd/monitor/cmd.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cmd/monitor/cmd.go b/cmd/monitor/cmd.go index d0a69e9e..66aa6051 100644 --- a/cmd/monitor/cmd.go +++ b/cmd/monitor/cmd.go @@ -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") From 86f5fb7375e5662d0ae8494a108f0ed3d1d84d47 Mon Sep 17 00:00:00 2001 From: Ji Hwan Date: Mon, 7 Oct 2024 21:21:28 +0900 Subject: [PATCH 2/2] chore: more descriptive error message Signed-off-by: Ji Hwan --- cmd/monitor/monitor.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/monitor/monitor.go b/cmd/monitor/monitor.go index e38905bd..09851ee4 100644 --- a/cmd/monitor/monitor.go +++ b/cmd/monitor/monitor.go @@ -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