fix: sanitize API error text display and add time_blockers tests
Add extractErrorMessage helper for JSON error body parsing and apply sanitizeText across all toast displays. Add time_blockers test coverage for new holiday placeholder cleanup and overlapping scenarios.
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
import { authStore } from '$lib/stores/auth.svelte';
|
||||
import { apiFetch } from '$lib/utils/api';
|
||||
import { toast } from 'svelte-sonner';
|
||||
import { extractErrorMessage } from '$lib/utils/toast-safe';
|
||||
import { Button } from '$lib/components/ui/button';
|
||||
import * as Card from '$lib/components/ui/card';
|
||||
import { Input } from '$lib/components/ui/input';
|
||||
@@ -257,7 +258,7 @@
|
||||
showEditModal = false;
|
||||
} else {
|
||||
const errText = await res.text();
|
||||
toast.error(errText || 'Failed to update settings');
|
||||
toast.error(extractErrorMessage(errText) || 'Failed to update settings');
|
||||
}
|
||||
} catch {
|
||||
toast.error('Network error saving settings');
|
||||
|
||||
Reference in New Issue
Block a user