Show backend error details in toast notifications

Use error.detail from API responses instead of generic i18n messages
so users see specific reasons for failures (e.g. "Device is referenced
by target(s): ...").

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-28 22:11:24 +03:00
parent 9b2ccde8a7
commit 493d96d604
5 changed files with 10 additions and 14 deletions

View File

@@ -735,7 +735,7 @@ export async function dashboardStartTarget(targetId) {
loadDashboard();
} else {
const error = await response.json();
showToast(t('dashboard.error.start_failed'), 'error');
showToast(error.detail || t('dashboard.error.start_failed'), 'error');
}
} catch (error) {
if (error.isAuth) return;
@@ -753,7 +753,7 @@ export async function dashboardStopTarget(targetId) {
loadDashboard();
} else {
const error = await response.json();
showToast(t('dashboard.error.stop_failed'), 'error');
showToast(error.detail || t('dashboard.error.stop_failed'), 'error');
}
} catch (error) {
if (error.isAuth) return;
@@ -772,7 +772,7 @@ export async function dashboardToggleAutoStart(targetId, enable) {
loadDashboard();
} else {
const error = await response.json();
showToast(t('dashboard.error.autostart_toggle_failed'), 'error');
showToast(error.detail || t('dashboard.error.autostart_toggle_failed'), 'error');
}
} catch (error) {
if (error.isAuth) return;