Files
pr-reviewer/src/gitea/run-best-effort.ts
T
Daan Schouteden 95fa696935 Centralize best-effort deletes: log errors and continue review flow.
All cleanup deletes now use runBestEffort so Gitea delete failures never abort posting the new review.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-03 13:29:40 +02:00

24 lines
674 B
TypeScript

import { log } from "../logging/logger.js";
/** Run a cleanup step; log failures and continue the review flow. */
export async function runBestEffort(input: {
operation: string;
correlationId?: string;
context?: Record<string, unknown>;
fn: () => Promise<void>;
}): Promise<void> {
try {
await input.fn();
log("info", `${input.operation} succeeded`, {
correlation_id: input.correlationId,
...input.context
});
} catch (error) {
log("warn", `${input.operation} failed (continuing)`, {
correlation_id: input.correlationId,
...input.context,
error: error instanceof Error ? error.message : String(error)
});
}
}