From f1a6b5f926cd47a69c9ad6996afa54ad39a486b7 Mon Sep 17 00:00:00 2001 From: Denis Bilenko Date: Thu, 23 Jan 2025 11:26:01 +0100 Subject: [PATCH] Do not show error for ErrAlreadyPrinted (it's already printed) --- cmd/root/root.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cmd/root/root.go b/cmd/root/root.go index 3b37d0176..4d0d42562 100644 --- a/cmd/root/root.go +++ b/cmd/root/root.go @@ -114,10 +114,15 @@ func Execute(ctx context.Context, cmd *cobra.Command) error { if err == nil { logger.Info("completed execution", slog.String("exit_code", "0")) + } else if errors.Is(err, ErrAlreadyPrinted) { + logger.Debug("failed execution", + slog.String("exit_code", "1"), + ) } else { logger.Error("failed execution", slog.String("exit_code", "1"), - slog.String("error", err.Error())) + slog.String("error", err.Error()), + ) } }