95fa696935
All cleanup deletes now use runBestEffort so Gitea delete failures never abort posting the new review. Co-authored-by: Cursor <cursoragent@cursor.com>
24 lines
674 B
TypeScript
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)
|
|
});
|
|
}
|
|
}
|