Wrap audit log export load errors and rename batch

Signed-off-by: Cursor Agent <cursoragent@cursor.com>

Co-authored-by: Bryan FRIMIN <bryan@frimin.fr>
This commit is contained in:
Cursor Agent
2026-07-29 20:30:08 +00:00
parent 1bdbe2c1a8
commit e9567c8e65

View File

@@ -100,8 +100,8 @@ func (s *LogExportService) streamAuditLogCSV(
Direction: page.OrderDirectionAsc, Direction: page.OrderDirectionAsc,
}, },
func(ctx context.Context, cursor *page.Cursor[coredata.AuditLogEntryOrderField]) ([]*coredata.AuditLogEntry, error) { func(ctx context.Context, cursor *page.Cursor[coredata.AuditLogEntryOrderField]) ([]*coredata.AuditLogEntry, error) {
var batch coredata.AuditLogEntries var logs coredata.AuditLogEntries
if err := batch.LoadByOrganizationID( if err := logs.LoadByOrganizationID(
ctx, ctx,
conn, conn,
scope, scope,
@@ -109,10 +109,10 @@ func (s *LogExportService) streamAuditLogCSV(
cursor, cursor,
filter, filter,
); err != nil { ); err != nil {
return nil, err return nil, fmt.Errorf("cannot load audit log entries: %w", err)
} }
return batch, nil return logs, nil
}, },
func(entries []*coredata.AuditLogEntry) error { func(entries []*coredata.AuditLogEntry) error {
actorsByID, err := loadAuditLogActorExportInfo(ctx, conn, entries) actorsByID, err := loadAuditLogActorExportInfo(ctx, conn, entries)
@@ -171,7 +171,7 @@ func (s *LogExportService) streamSCIMEventCSV(
cursor, cursor,
filter, filter,
); err != nil { ); err != nil {
return nil, err return nil, fmt.Errorf("cannot load SCIM events: %w", err)
} }
return events, nil return events, nil