fix: replace empty catch blocks with error logging

This commit is contained in:
2026-06-16 01:14:31 +02:00
committed by Milas Holsting
parent 641f97fb8e
commit 22f05580df
3 changed files with 8 additions and 6 deletions

View File

@@ -211,10 +211,8 @@ export const setupSegmentEditor = (): void => {
});
if (!res.ok) {
let message = res.status === 401 ? "Login required." : "Failed to save segment.";
try {
const payload = (await res.json()) as { error?: string };
if (payload?.error) message = payload.error;
} catch {}
const payload = (await res.json().catch(() => null)) as { error?: string } | null;
if (payload?.error) message = payload.error;
setError(message);
return;
}