Skip to content

Commit

Permalink
Log Audit Error instead of operation error when auditing fails (#47783)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoandredinis authored Oct 22, 2024
1 parent 985c8a9 commit 3c77158
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/auth/crownjewel/crownjewelv1/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func (s *Service) emitCreateAuditEvent(ctx context.Context, req *crownjewelv1.Cr
},
CrownJewelQuery: req.GetSpec().GetQuery(),
}); auditErr != nil {
slog.WarnContext(ctx, "Failed to emit crown jewel create event.", "error", err)
slog.WarnContext(ctx, "Failed to emit crown jewel create event.", "error", auditErr)
}
}

Expand Down Expand Up @@ -237,7 +237,7 @@ func (s *Service) emitUpdateAuditEvent(ctx context.Context, old, new *crownjewel
CurrentCrownJewelQuery: old.GetSpec().GetQuery(),
UpdatedCrownJewelQuery: new.GetSpec().GetQuery(),
}); auditErr != nil {
slog.WarnContext(ctx, "Failed to emit crown jewel update event.", "error", err)
slog.WarnContext(ctx, "Failed to emit crown jewel update event.", "error", auditErr)
}
}

Expand Down Expand Up @@ -315,7 +315,7 @@ func (s *Service) DeleteCrownJewel(ctx context.Context, req *crownjewelv1.Delete
UpdatedBy: authCtx.Identity.GetIdentity().Username,
},
}); auditErr != nil {
slog.WarnContext(ctx, "Failed to emit crown jewel delete event.", "error", err)
slog.WarnContext(ctx, "Failed to emit crown jewel delete event.", "error", auditErr)
}

if err != nil {
Expand Down

0 comments on commit 3c77158

Please sign in to comment.