src/features/reviews/save-failure.ts
Linked repository file from this build.
export type SaveFailure = "conflict" | "rejected" | "retry";
/** Decide how the review editor recovers when the server does not accept a save. */
export function classifySaveFailure(status: number): SaveFailure {
if (status === 409) return "conflict";
// Sign-in, timeout and rate limits can pass. Other 4xx answers refuse this exact batch.
if (status >= 400 && status < 500 && ![401, 408, 429].includes(status)) return "rejected";
return "retry";
}