harden(eoc-push): fånga mappningsfel så pushen aldrig kastar
This commit is contained in:
@@ -139,7 +139,16 @@ export async function pushOpsSummaryToEoc(redis: Redis): Promise<EocPushResult>
|
||||
return { ok: false, status: null, error: "ops summary cache is not a JSON object" };
|
||||
}
|
||||
|
||||
const body = JSON.stringify(mapPayloadForEoc(parsed as Record<string, unknown>));
|
||||
let body: string;
|
||||
try {
|
||||
body = JSON.stringify(mapPayloadForEoc(parsed as Record<string, unknown>));
|
||||
} catch (err) {
|
||||
return {
|
||||
ok: false,
|
||||
status: null,
|
||||
error: `payload mapping failed: ${err instanceof Error ? err.message : String(err)}`,
|
||||
};
|
||||
}
|
||||
|
||||
const controller = new AbortController();
|
||||
const timeout = setTimeout(() => controller.abort(), EOC_PUSH_TIMEOUT_MS);
|
||||
|
||||
Reference in New Issue
Block a user