Do not show error for ErrAlreadyPrinted (it's already printed)

This commit is contained in:
Denis Bilenko 2025-01-23 11:26:01 +01:00
parent 91c13dcdfc
commit f1a6b5f926
1 changed files with 6 additions and 1 deletions

View File

@ -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()),
)
}
}