refactor(web/api): errCode + errMessage helpers; 41 sites migrated (W1)

This commit is contained in:
2026-05-07 22:17:45 -04:00
parent 965df28127
commit 9c91a342e2
16 changed files with 138 additions and 70 deletions
+3 -1
View File
@@ -3,6 +3,7 @@
import { Flag } from 'lucide-svelte';
import { useQueryClient } from '@tanstack/svelte-query';
import { flagTrack } from '$lib/api/quarantine';
import { errCode } from '$lib/api/errors';
import { qk } from '$lib/api/queries';
import type { TrackRef, LidarrQuarantineReason } from '$lib/api/types';
@@ -34,7 +35,8 @@
await client.invalidateQueries({ queryKey: qk.myQuarantine() });
onClose();
} catch (e) {
error = (e as { code?: string }).code ?? 'flag_failed';
const code = errCode(e);
error = code === 'unknown' ? 'flag_failed' : code;
} finally {
submitting = false;
}