ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.
Python astracloudflarecontrol-panelcyberpaneldnsfablehosting-control-panelhosting-panelkimi-k3server-managementserverkitubuntu-web-panelwebserver
Show the server's reason in every error toast
Juan Denis708c73c5da06
diff --git a/frontend/scripts/check-frontend-boundaries.mjs b/frontend/scripts/check-frontend-boundaries.mjsindex 38c4c0e5..83b73694 100644--- a/frontend/scripts/check-frontend-boundaries.mjs+++ b/frontend/scripts/check-frontend-boundaries.mjs@@ -228,7 +228,9 @@ const ADOPTION_CEILINGS = [name: 'per-page toast.error extractions in pages/ (E1: query-layer error presentation)',ceiling: 206,include: (file) => file.startsWith('pages/'),- pattern: /toast\s*\.\s*error\s*\(/g,+ // toastError(toast, …) (utils/errorMessage) is the same per-page+ // presentation with the server reason attached, so it counts too.+ pattern: /toast\s*\.\s*error\s*\(|\btoastError\s*\(/g,},{name: 'hand-rolled form-group blocks (F2: FormField/useForm)',diff --git a/frontend/src/components/EmailProviders.jsx b/frontend/src/components/EmailProviders.jsxindex 6aa65839..c2b8bc6b 100644--- a/frontend/src/components/EmailProviders.jsx+++ b/frontend/src/components/EmailProviders.jsx@@ -7,6 +7,7 @@ import { Label } from '@/components/ui/label';import PortField from './PortField';import { useToast } from '../contexts/useToast.js';import { useTranslation } from 'react-i18next';+import { toastError } from '@/utils/errorMessage';const FIELD_LABELS = {host: 'Host', port: 'Port', username: 'Username', password: 'Password', use_tls: 'Use TLS',@@ -74,7 +75,7 @@ export default function EmailProviders() {cancel();load();} catch (e) {- toast.error(e?.message || t('app.emailProviders.failedToAddProvider', 'Failed to add provider'));+ toastError(toast, t('app.emailProviders.failedToAddProvider', 'Failed to add provider'), e);} finally {setBusy(false);}@@ -84,10 +85,10 @@ export default function EmailProviders() {setBusy(true);try {const r = await api.testEmailProvider(id);- if (r.success) toast.success(t('app.emailProviders.credentialsOk', 'Credentials OK')); else toast.error(r.error || t('app.emailProviders.testFailed', 'Test failed'));+ if (r.success) toast.success(t('app.emailProviders.credentialsOk', 'Credentials OK')); else toastError(toast, t('app.emailProviders.testFailed', 'Test failed'), r.error);load();- } catch {- toast.error(t('app.emailProviders.testFailed', 'Test failed'));+ } catch (err) {+ toastError(toast, t('app.emailProviders.testFailed', 'Test failed'), err);} finally {setBusy(false);}@@ -95,12 +96,12 @@ export default function EmailProviders() {const onDefault = async (id) => {try { await api.setDefaultEmailProvider(id); toast.success(t('app.emailProviders.defaultTransportUpdated', 'Default transport updated')); load(); }- catch { toast.error(t('app.emailProviders.failedToSetDefault', 'Failed to set default')); }+ catch (err) { toastError(toast, t('app.emailProviders.failedToSetDefault', 'Failed to set default'), err); }};const onDelete = async (id) => {try { await api.deleteEmailProvider(id); toast.success(t('app.emailProviders.providerRemoved', 'Provider deleted')); setConfirmId(null); load(); }- catch { toast.error(t('app.emailProviders.failedToRemove', 'Failed to delete')); }+ catch (err) { toastError(toast, t('app.emailProviders.failedToRemove', 'Failed to delete'), err); }};return (diff --git a/frontend/src/components/EnvironmentVariables.jsx b/frontend/src/components/EnvironmentVariables.jsxindex 03e86570..9fd2a266 100644--- a/frontend/src/components/EnvironmentVariables.jsx+++ b/frontend/src/components/EnvironmentVariables.jsx@@ -24,6 +24,7 @@ import { useConfirm } from '@/hooks/useConfirm';import { useClipboard } from '@/hooks/useClipboard';import { downloadBlob } from '@/utils/downloadBlob';import { useTranslation } from 'react-i18next';+import { toastError } from '@/utils/errorMessage';// What a masked value renders as. Unchanged from the list this table replaces:// every env var is stored as a secret, so every value is dots until the row's@@ -73,7 +74,7 @@ const EVERY_SERVICE = '__all';const EnvironmentVariables = ({ appId }) => {const { t } = useTranslation();const toast = useToast();- const toastError = toast.error;+ const showError = toast.error;const { confirm } = useConfirm();const { copy } = useClipboard();const [envVars, setEnvVars] = useState([]);@@ -130,12 +131,12 @@ const EnvironmentVariables = ({ appId }) => {const data = await api.getEnvVars(appId);setEnvVars(data.env_vars || []);} catch (err) {- toastError(t('app.environmentVariables.failedToLoadEnvironmentVariables', 'Failed to load environment variables'));+ toastError(showError, t('app.environmentVariables.failedToLoadEnvironmentVariables', 'Failed to load environment variables'), err);console.error('Failed to load env vars:', err);} finally {setLoading(false);}- }, [appId, t, toastError]);+ }, [appId, t, showError]);useEffect(() => {loadEnvVars();@@ -171,7 +172,7 @@ const EnvironmentVariables = ({ appId }) => {setShowAddModal(false);loadEnvVars();} catch (err) {- toast.error(err.message || t('app.environmentVariables.failedToAddEnvironmentVariable', 'Failed to add environment variable'));+ toastError(toast, t('app.environmentVariables.failedToAddEnvironmentVariable', 'Failed to add environment variable'), err);} finally {setSaving(false);}@@ -195,7 +196,7 @@ const EnvironmentVariables = ({ appId }) => {setEditTargetService('');loadEnvVars();} catch (err) {- toast.error(err.message || t('app.environmentVariables.failedToUpdateEnvironmentVariable', 'Failed to update environment variable'));+ toastError(toast, t('app.environmentVariables.failedToUpdateEnvironmentVariable', 'Failed to update environment variable'), err);} finally {setSaving(false);}@@ -213,7 +214,7 @@ const EnvironmentVariables = ({ appId }) => {toast.success(t('app.environmentVariables.environmentVariableDeleted', 'Environment variable deleted'));loadEnvVars();} catch (err) {- toast.error(err.message || t('app.environmentVariables.failedToDeleteEnvironmentVariable', 'Failed to delete environment variable'));+ toastError(toast, t('app.environmentVariables.failedToDeleteEnvironmentVariable', 'Failed to delete environment variable'), err);}}@@ -255,8 +256,8 @@ const EnvironmentVariables = ({ appId }) => {const data = await api.exportEnvFile(appId, includeSecrets);downloadBlob(data.content, data.filename || 'app.env');toast.success(t('app.environmentVariables.environmentFileExported', 'Environment file exported'));- } catch {- toast.error(t('app.environmentVariables.failedToExport', 'Failed to export'));+ } catch (err) {+ toastError(toast, t('app.environmentVariables.failedToExport', 'Failed to export'), err);}}@@ -274,7 +275,7 @@ const EnvironmentVariables = ({ appId }) => {setImportContent('');loadEnvVars();} catch (err) {- toast.error(err.message || t('app.environmentVariables.failedToImport', 'Failed to import'));+ toastError(toast, t('app.environmentVariables.failedToImport', 'Failed to import'), err);} finally {setSaving(false);}@@ -296,8 +297,8 @@ const EnvironmentVariables = ({ appId }) => {const data = await api.getEnvVarHistory(appId);setHistory(data.history || []);setShowHistoryModal(true);- } catch {- toast.error(t('app.environmentVariables.failedToLoadHistory', 'Failed to load history'));+ } catch (err) {+ toastError(toast, t('app.environmentVariables.failedToLoadHistory', 'Failed to load history'), err);}}@@ -317,8 +318,8 @@ const EnvironmentVariables = ({ appId }) => {await api.clearEnvVars(appId);toast.success(t('app.environmentVariables.allEnvironmentVariablesCleared', 'All environment variables cleared'));loadEnvVars();- } catch {- toast.error(t('app.environmentVariables.failedToClear', 'Failed to clear'));+ } catch (err) {+ toastError(toast, t('app.environmentVariables.failedToClear', 'Failed to clear'), err);}}diff --git a/frontend/src/components/ErrorState.jsx b/frontend/src/components/ErrorState.jsxindex 5e390a4d..f322d295 100644--- a/frontend/src/components/ErrorState.jsx+++ b/frontend/src/components/ErrorState.jsx@@ -1,6 +1,7 @@import { AlertTriangle, RefreshCw } from 'lucide-react';import { Button } from '@/components/ui/button';import { t } from '@/i18n/t';+import { errorReason } from '@/utils/errorMessage';/*** Consistent error state for pages and panels. Shows an icon, title, message,@@ -20,7 +21,7 @@ export function ErrorState({compact = false,className = '',}) {- const errorMessage = message || error?.message+ const errorMessage = message || errorReason(error)|| t('common.error.loadingData', 'An error occurred while loading data');if (compact) {diff --git a/frontend/src/components/OperationsDock.jsx b/frontend/src/components/OperationsDock.jsxindex 37babcef..84c35da7 100644--- a/frontend/src/components/OperationsDock.jsx+++ b/frontend/src/components/OperationsDock.jsx@@ -30,6 +30,7 @@ import FormField from './FormField';import ShellDockTabs from './ShellDockTabs';import Pill from './ds/Pill';import { statusKind, statusLabel } from './ds/status';+import { toastError } from '@/utils/errorMessage';const VIEWS = ['active', 'attention', 'history'];@@ -300,7 +301,7 @@ export default function OperationsDock({ hideLauncher = false, statusbarMode = fawait refresh();toast.success(t('app.operationsDock.cancelQueued', 'Cancellation requested'));} catch (error) {- toast.error(error?.message || t('app.operationsDock.actionFailed', 'Operation action failed'));+ toastError(toast, t('app.operationsDock.actionFailed', 'Operation action failed'), error);}};@@ -312,7 +313,7 @@ export default function OperationsDock({ hideLauncher = false, statusbarMode = fawait refresh();toast.success(t('app.operationsDock.retryQueued', 'Retry queued'));} catch (error) {- toast.error(error?.message || t('app.operationsDock.actionFailed', 'Operation action failed'));+ toastError(toast, t('app.operationsDock.actionFailed', 'Operation action failed'), error);}};diff --git a/frontend/src/components/PrivateURLSection.jsx b/frontend/src/components/PrivateURLSection.jsxindex cb1f4e62..acdf0f3c 100644--- a/frontend/src/components/PrivateURLSection.jsx+++ b/frontend/src/components/PrivateURLSection.jsx@@ -5,6 +5,7 @@ import { useConfirm } from '../hooks/useConfirm';import CopyField from './CopyField';import { useTranslation } from 'react-i18next';import { Button as SharedButton } from '@/components/ui/button';+import { toastError } from '@/utils/errorMessage';const PrivateURLSection = ({ app, onUpdate }) => {const { t } = useTranslation();@@ -26,7 +27,7 @@ const PrivateURLSection = ({ app, onUpdate }) => {onUpdate();setCustomSlug('');} catch (error) {- toast.error(error.message || t('app.privateURLSection.failedToEnablePrivateUrl', 'Failed to enable private URL'));+ toastError(toast, t('app.privateURLSection.failedToEnablePrivateUrl', 'Failed to enable private URL'), error);} finally {setLoading(false);}@@ -45,7 +46,7 @@ const PrivateURLSection = ({ app, onUpdate }) => {toast.success(t('app.privateURLSection.privateUrlDisabled', 'Private URL disabled'));onUpdate();} catch (error) {- toast.error(error.message || t('app.privateURLSection.failedToDisablePrivateUrl', 'Failed to disable private URL'));+ toastError(toast, t('app.privateURLSection.failedToDisablePrivateUrl', 'Failed to disable private URL'), error);} finally {setLoading(false);}@@ -64,7 +65,7 @@ const PrivateURLSection = ({ app, onUpdate }) => {toast.success(t('app.privateURLSection.privateUrlRegenerated', 'Private URL regenerated'));onUpdate();} catch (error) {- toast.error(error.message || t('app.privateURLSection.failedToRegenerate', 'Failed to regenerate'));+ toastError(toast, t('app.privateURLSection.failedToRegenerate', 'Failed to regenerate'), error);} finally {setLoading(false);}@@ -82,7 +83,7 @@ const PrivateURLSection = ({ app, onUpdate }) => {setEditMode(false);setCustomSlug('');} catch (error) {- toast.error(error.message || t('app.privateURLSection.failedToUpdateSlug', 'Failed to update slug'));+ toastError(toast, t('app.privateURLSection.failedToUpdateSlug', 'Failed to update slug'), error);} finally {setLoading(false);}diff --git a/frontend/src/components/apps/AppWafPanel.jsx b/frontend/src/components/apps/AppWafPanel.jsxindex f102b055..bca9dd03 100644--- a/frontend/src/components/apps/AppWafPanel.jsx+++ b/frontend/src/components/apps/AppWafPanel.jsx@@ -7,6 +7,7 @@ import { Button } from '@/components/ui/button';import { Input } from '@/components/ui/input';import { Label } from '@/components/ui/label';import { useTranslation } from 'react-i18next';+import { toastError } from '@/utils/errorMessage';// WAF modes with one-line descriptions shown under the selector.const MODE_OPTIONS = [@@ -124,13 +125,13 @@ const AppWafPanel = ({ app, onChanged }) => {try {const result = await api.installWaf();if (result?.success === false) {- toast.error(result.message || result.error || t('app.appWafPanel.failedToInstallModsecurity', 'Failed to install ModSecurity'));+ toastError(toast, t('app.appWafPanel.failedToInstallModsecurity', 'Failed to install ModSecurity'), result);} else {toast.success(result?.message || t('app.appWafPanel.modsecurityInstalled', 'ModSecurity installed'));}await loadStatus();} catch (err) {- toast.error(err.message || t('app.appWafPanel.failedToInstallModsecurity', 'Failed to install ModSecurity'));+ toastError(toast, t('app.appWafPanel.failedToInstallModsecurity', 'Failed to install ModSecurity'), err);} finally {setInstalling(false);}@@ -184,7 +185,7 @@ const AppWafPanel = ({ app, onChanged }) => {toast.success(t('app.appWafPanel.wafPolicySaved', 'WAF policy saved'));onChanged?.();} catch (err) {- toast.error(err.message || t('app.appWafPanel.failedToSaveWafPolicy', 'Failed to save WAF policy'));+ toastError(toast, t('app.appWafPanel.failedToSaveWafPolicy', 'Failed to save WAF policy'), err);} finally {setSaving(false);}@@ -195,7 +196,7 @@ const AppWafPanel = ({ app, onChanged }) => {try {const result = await api.applyWaf(app.id);if (result?.success === false) {- toast.error(result.message || result.error || t('app.appWafPanel.failedToApplyWafRules', 'Failed to apply WAF rules'));+ toastError(toast, t('app.appWafPanel.failedToApplyWafRules', 'Failed to apply WAF rules'), result);} else if (result?.manual_include) {toast.warning(t('app.appWafPanel.rulesWrittenButNoVhostWas', 'Rules written, but no vhost was found. Include it manually: {{manualinclude}}', { manualinclude: result.manual_include }),@@ -205,7 +206,7 @@ const AppWafPanel = ({ app, onChanged }) => {toast.success(result?.message || t('app.appWafPanel.wafRulesAppliedAndNginxReloaded', 'WAF rules applied and nginx reloaded.'));}} catch (err) {- toast.error(err.message || t('app.appWafPanel.failedToApplyWafRules', 'Failed to apply WAF rules'));+ toastError(toast, t('app.appWafPanel.failedToApplyWafRules', 'Failed to apply WAF rules'), err);} finally {setApplying(false);}diff --git a/frontend/src/components/apps/ContainerOpsPanel.jsx b/frontend/src/components/apps/ContainerOpsPanel.jsxindex 50d8be11..6630d23a 100644--- a/frontend/src/components/apps/ContainerOpsPanel.jsx+++ b/frontend/src/components/apps/ContainerOpsPanel.jsx@@ -13,6 +13,7 @@ import { Switch } from '@/components/ui/switch';import { Select, SelectTrigger, SelectContent, SelectItem, SelectValue } from '@/components/ui/select';import { InfoList, InfoItem } from '../InfoList';import { useTranslation } from 'react-i18next';+import { toastError } from '@/utils/errorMessage';// Short SHA helper for image digests (handles "sha256:abcdef..." or bare hashes)function shortDigest(digest) {@@ -68,7 +69,7 @@ const ImageUpdateSection = ({ app, onChanged }) => {}onChanged?.();} catch (err) {- toast.error(err.message || t('app.containerOpsPanel.failedToCheckForUpdates', 'Failed to check for updates'));+ toastError(toast, t('app.containerOpsPanel.failedToCheckForUpdates', 'Failed to check for updates'), err);} finally {setChecking(false);}@@ -93,7 +94,7 @@ const ImageUpdateSection = ({ app, onChanged }) => {if (refreshed) setInfo(refreshed);} catch { /* optional */ }} catch (err) {- toast.error(err.message || t('app.containerOpsPanel.failedToApplyUpdate', 'Failed to apply update'));+ toastError(toast, t('app.containerOpsPanel.failedToApplyUpdate', 'Failed to apply update'), err);} finally {setApplying(false);}@@ -186,7 +187,7 @@ const RegistrySection = ({ app, onChanged }) => {toast.success(next ? t('app.containerOpsPanel.registryAttached', 'Registry attached') : t('app.containerOpsPanel.registryDetachedPullsAreAnonymous', 'Registry detached. Pulls are anonymous.'));onChanged?.();} catch (err) {- toast.error(err.message || t('app.containerOpsPanel.failedToUpdateRegistry', 'Failed to update registry'));+ toastError(toast, t('app.containerOpsPanel.failedToUpdateRegistry', 'Failed to update registry'), err);setSelected(app.registry_id ?? '');} finally {setSaving(false);@@ -271,7 +272,7 @@ const AutoSleepSection = ({ app, onChanged }) => {toast.success(t('app.containerOpsPanel.autoSleepPolicySaved', 'Auto-sleep policy saved'));onChanged?.();} catch (err) {- toast.error(err.message || t('app.containerOpsPanel.failedToSavePolicy', 'Failed to save policy'));+ toastError(toast, t('app.containerOpsPanel.failedToSavePolicy', 'Failed to save policy'), err);load();} finally {setSaving(false);@@ -304,7 +305,7 @@ const AutoSleepSection = ({ app, onChanged }) => {await load();onChanged?.();} catch (err) {- toast.error(err.message || t('app.containerOpsPanel.actionFailed', 'Action failed'));+ toastError(toast, t('app.containerOpsPanel.actionFailed', 'Action failed'), err);} finally {setBusy(false);}diff --git a/frontend/src/components/apps/DeploySafetyPanel.jsx b/frontend/src/components/apps/DeploySafetyPanel.jsxindex e7bd12e7..70c4bde1 100644--- a/frontend/src/components/apps/DeploySafetyPanel.jsx+++ b/frontend/src/components/apps/DeploySafetyPanel.jsx@@ -6,6 +6,7 @@ import { Button } from '@/components/ui/button';import { Input } from '@/components/ui/input';import { Switch } from '@/components/ui/switch';import { useTranslation } from 'react-i18next';+import { toastError } from '@/utils/errorMessage';// Must match app/services/deploy_settings.py DEFAULTS / _RULES.const TIMEOUT_DEFAULT = 120;@@ -44,7 +45,7 @@ const DeploySafetyPanel = ({ app, onChanged }) => {toast.success(t('app.deploySafetyPanel.saved', 'Health check settings saved'));onChanged?.();} catch (err) {- toast.error(err.message || t('app.deploySafetyPanel.saveFailed', 'Failed to save health check settings'));+ toastError(toast, t('app.deploySafetyPanel.saveFailed', 'Failed to save health check settings'), err);} finally {setSaving(false);}diff --git a/frontend/src/components/apps/HtaccessConverter.jsx b/frontend/src/components/apps/HtaccessConverter.jsxindex b73ee46c..08039285 100644--- a/frontend/src/components/apps/HtaccessConverter.jsx+++ b/frontend/src/components/apps/HtaccessConverter.jsx@@ -7,6 +7,7 @@ import { CopyButton } from '@/components/CopyButton';import api from '../../services/api';import { useToast } from '../../contexts/useToast.js';import { useTranslation } from 'react-i18next';+import { toastError } from '@/utils/errorMessage';// Paste-in .htaccess -> nginx converter for the per-site custom nginx rules// editor. Pairs with the site-import feature: imported cPanel sites carry@@ -35,7 +36,7 @@ export default function HtaccessConverter({ onInsert, trigger = null }) {toast.info(t('app.htaccessConverter.nothingToConvertNoDirectivesFound', 'Nothing to convert. No directives found.'));}} catch (err) {- toast.error(err.message || t('app.htaccessConverter.conversionFailed', 'Conversion failed'));+ toastError(toast, t('app.htaccessConverter.conversionFailed', 'Conversion failed'), err);} finally {setConverting(false);}diff --git a/frontend/src/components/apps/MicroCachePanel.jsx b/frontend/src/components/apps/MicroCachePanel.jsxindex 0911c359..db233910 100644--- a/frontend/src/components/apps/MicroCachePanel.jsx+++ b/frontend/src/components/apps/MicroCachePanel.jsx@@ -8,6 +8,7 @@ import { Switch } from '@/components/ui/switch';import { useConfirm } from '@/hooks/useConfirm';import { formatPercent } from '@/utils/intl';import { useTranslation } from 'react-i18next';+import { toastError } from '@/utils/errorMessage';// Must match NginxService.MICROCACHE_TTL_DEFAULT / MICROCACHE_TTL_MAX.const TTL_DEFAULT = 10;@@ -70,7 +71,7 @@ const MicroCachePanel = ({ app, onChanged }) => {}} catch (err) {setEnabled(!next);- toast.error(err.message || t('app.microCachePanel.failedToUpdateMicroCache', 'Failed to update micro-cache'));+ toastError(toast, t('app.microCachePanel.failedToUpdateMicroCache', 'Failed to update micro-cache'), err);}}@@ -79,7 +80,7 @@ const MicroCachePanel = ({ app, onChanged }) => {await save(enabled, ttlNumber);toast.success(t('app.microCachePanel.cacheLifetimeSaved', 'Cache lifetime saved'));} catch (err) {- toast.error(err.message || t('app.microCachePanel.failedToUpdateMicroCache', 'Failed to update micro-cache'));+ toastError(toast, t('app.microCachePanel.failedToUpdateMicroCache', 'Failed to update micro-cache'), err);}}@@ -92,7 +93,7 @@ const MicroCachePanel = ({ app, onChanged }) => {onChanged?.();} catch (err) {setImmutable(!next);- toast.error(err.message);+ toastError(toast, t('app.microCachePanel.couldntUpdateImmutableAssets', "Couldn't update immutable asset caching."), err);}}@@ -107,7 +108,7 @@ const MicroCachePanel = ({ app, onChanged }) => {const data = await api.purgeMicroCache(app.id);toast.success(data.message || t('app.microCachePanel.microCacheCleared', 'Micro-cache cleared'));} catch (err) {- toast.error(err.message || t('app.microCachePanel.failedToClearTheMicroCache', 'Failed to clear the micro-cache'));+ toastError(toast, t('app.microCachePanel.failedToClearTheMicroCache', 'Failed to clear the micro-cache'), err);} finally {setPurging(false);}diff --git a/frontend/src/components/apps/ResourceLimitsPanel.jsx b/frontend/src/components/apps/ResourceLimitsPanel.jsxindex d3362fb1..6080b73e 100644--- a/frontend/src/components/apps/ResourceLimitsPanel.jsx+++ b/frontend/src/components/apps/ResourceLimitsPanel.jsx@@ -6,6 +6,7 @@ import { Button } from '@/components/ui/button';import { Input } from '@/components/ui/input';import { Label } from '@/components/ui/label';import { useTranslation } from 'react-i18next';+import { toastError } from '@/utils/errorMessage';// Docker memory limit: number + one-letter unit (b/k/m/g), e.g. "512m", "2g".const MEMORY_LIMIT_RE = /^\d+(\.\d+)?(b|k|m|g)$/i;@@ -81,7 +82,7 @@ const ResourceLimitsPanel = ({ app, onChanged }) => {: t('app.resourceLimitsPanel.resourceLimitsSaved', 'Resource limits saved'));onChanged?.();} catch (err) {- toast.error(err.message || t('app.resourceLimitsPanel.failedToSaveResourceLimits', 'Failed to save resource limits'));+ toastError(toast, t('app.resourceLimitsPanel.failedToSaveResourceLimits', 'Failed to save resource limits'), err);} finally {setSaving(false);}diff --git a/frontend/src/components/apps/SlotDeploysPanel.jsx b/frontend/src/components/apps/SlotDeploysPanel.jsxindex dc2d0673..b03d05bc 100644--- a/frontend/src/components/apps/SlotDeploysPanel.jsx+++ b/frontend/src/components/apps/SlotDeploysPanel.jsx@@ -7,6 +7,7 @@ import { Button } from '@/components/ui/button';import { Input } from '@/components/ui/input';import { Switch } from '@/components/ui/switch';import { useTranslation } from 'react-i18next';+import { toastError } from '@/utils/errorMessage';// Must match app/services/deploy_settings.py DEFAULTS / _RULES.const WATCH_DEFAULT = 60;@@ -65,7 +66,7 @@ const SlotDeploysPanel = ({ app, onChanged }) => {: (data.note || t('app.slotDeploysPanel.disabled', 'Slot deploys off')));onChanged?.();} catch (err) {- toast.error(err.message || t('app.slotDeploysPanel.toggleFailed', 'Could not change slot deploys'));+ toastError(toast, t('app.slotDeploysPanel.toggleFailed', 'Could not change slot deploys'), err);} finally {setToggling(false);}@@ -87,7 +88,7 @@ const SlotDeploysPanel = ({ app, onChanged }) => {toast.success(t('app.slotDeploysPanel.saved', 'Rollout settings saved'));onChanged?.();} catch (err) {- toast.error(err.message || t('app.slotDeploysPanel.saveFailed', 'Failed to save rollout settings'));+ toastError(toast, t('app.slotDeploysPanel.saveFailed', 'Failed to save rollout settings'), err);} finally {setSaving(false);}@@ -97,7 +98,7 @@ const SlotDeploysPanel = ({ app, onChanged }) => {try {setSplit(await api.previewAppComposeSplit(app.id));} catch (err) {- toast.error(err.message || t('app.slotDeploysPanel.splitPreviewFailed', 'Could not preview the split'));+ toastError(toast, t('app.slotDeploysPanel.splitPreviewFailed', 'Could not preview the split'), err);}}@@ -110,7 +111,7 @@ const SlotDeploysPanel = ({ app, onChanged }) => {toast.success(t('app.slotDeploysPanel.splitDone', 'Stateful compose services moved. The service now deploys through slots.'));onChanged?.();} catch (err) {- toast.error(err.message || t('app.slotDeploysPanel.splitFailed', 'The split failed'));+ toastError(toast, t('app.slotDeploysPanel.splitFailed', 'The split failed'), err);} finally {setSplitting(false);}diff --git a/frontend/src/components/apps/VolumesPanel.jsx b/frontend/src/components/apps/VolumesPanel.jsxindex 63aae5f6..fba27653 100644--- a/frontend/src/components/apps/VolumesPanel.jsx+++ b/frontend/src/components/apps/VolumesPanel.jsx@@ -9,6 +9,7 @@ import { Input } from '@/components/ui/input';import { Label } from '@/components/ui/label';import { Checkbox } from '@/components/ui/checkbox';import { useTranslation } from 'react-i18next';+import { toastError } from '@/utils/errorMessage';// A single volume row with an inline detach confirm (the "also delete data"// checkbox is off by default and disabled while the app is running, so a detach@@ -85,7 +86,7 @@ const VolumesPanel = ({ app, onChanged }) => {const data = await api.getAppVolumes(app.id);setVolumes(data?.volumes || []);} catch (err) {- toast.error(err.message || t('app.volumesPanel.failedToLoadVolumes', 'Failed to load volumes'));+ toastError(toast, t('app.volumesPanel.failedToLoadVolumes', 'Failed to load volumes'), err);} finally {setLoading(false);}@@ -107,7 +108,7 @@ const VolumesPanel = ({ app, onChanged }) => {await load();onChanged?.();} catch (err) {- toast.error(err.message || t('app.volumesPanel.failedToAttachVolume', 'Failed to attach volume'));+ toastError(toast, t('app.volumesPanel.failedToAttachVolume', 'Failed to attach volume'), err);} finally {setAttaching(false);}@@ -120,7 +121,7 @@ const VolumesPanel = ({ app, onChanged }) => {await load();onChanged?.();} catch (err) {- toast.error(err.message || t('app.volumesPanel.failedToDetachVolume', 'Failed to detach volume'));+ toastError(toast, t('app.volumesPanel.failedToDetachVolume', 'Failed to detach volume'), err);}}diff --git a/frontend/src/components/backups/ProtectionPanel.jsx b/frontend/src/components/backups/ProtectionPanel.jsxindex 73f3f9ab..2688729d 100644--- a/frontend/src/components/backups/ProtectionPanel.jsx+++ b/frontend/src/components/backups/ProtectionPanel.jsx@@ -19,6 +19,7 @@ import BackupCalendar from './BackupCalendar';import BackupDetailDrawer from './BackupDetailDrawer';import RestoreDrawer from './RestoreDrawer';import { useTranslation } from 'react-i18next';+import { toastError } from '@/utils/errorMessage';function sameLocalDay(iso, date) {if (!iso) return false;@@ -76,7 +77,7 @@ export default function ProtectionPanel({ targetType, targetId, targetName, showsetView(policyView);setRuns(runsResp?.runs || []);} catch (err) {- toast.error(err.message || t('app.protectionPanel.failedToLoadProtectionSettings', 'Failed to load protection settings'));+ toastError(toast, t('app.protectionPanel.failedToLoadProtectionSettings', 'Failed to load protection settings'), err);} finally {setLoading(false);}@@ -109,7 +110,7 @@ export default function ProtectionPanel({ targetType, targetId, targetName, showsetView(updated);toast.success(enabled ? t('app.protectionPanel.automaticBackupsEnabled', 'Automatic backups enabled') : t('app.protectionPanel.automaticBackupsDisabled', 'Automatic backups disabled'));} catch (err) {- toast.error(err.message || t('app.protectionPanel.failedToUpdateProtection', 'Failed to update protection'));+ toastError(toast, t('app.protectionPanel.failedToUpdateProtection', 'Failed to update protection'), err);} finally {setSaving(false);}@@ -122,7 +123,7 @@ export default function ProtectionPanel({ targetType, targetId, targetName, showsetView(updated);toast.success(t('app.protectionPanel.scheduleSaved', 'Schedule saved'));} catch (err) {- toast.error(err.message || t('app.protectionPanel.failedToSaveSchedule', 'Failed to save schedule'));+ toastError(toast, t('app.protectionPanel.failedToSaveSchedule', 'Failed to save schedule'), err);} finally {setSaving(false);}@@ -136,7 +137,7 @@ export default function ProtectionPanel({ targetType, targetId, targetName, showtoast.success(t('app.protectionPanel.backupStarted', 'Backup started'));scheduleReloads();} catch (err) {- toast.error(err.message || t('app.protectionPanel.failedToStartBackup', 'Failed to start backup'));+ toastError(toast, t('app.protectionPanel.failedToStartBackup', 'Failed to start backup'), err);} finally {setBackingUp(false);}@@ -149,7 +150,7 @@ export default function ProtectionPanel({ targetType, targetId, targetName, showtoast.success(t('app.protectionPanel.restoreDrillStarted', 'Restore drill started'));scheduleReloads();} catch (err) {- toast.error(err.message || t('app.protectionPanel.failedToStartRestoreDrill', 'Failed to start restore drill'));+ toastError(toast, t('app.protectionPanel.failedToStartRestoreDrill', 'Failed to start restore drill'), err);} finally {setDrilling(false);}@@ -170,7 +171,7 @@ export default function ProtectionPanel({ targetType, targetId, targetName, showsetDetailRun(null);scheduleReloads();} catch (err) {- toast.error(err.message || t('app.protectionPanel.failedToStartRestore', 'Failed to start restore'));+ toastError(toast, t('app.protectionPanel.failedToStartRestore', 'Failed to start restore'), err);}}, [restoreRun, targetType, targetId, showMaintenanceModeOption, toast, t, scheduleReloads]);@@ -181,7 +182,7 @@ export default function ProtectionPanel({ targetType, targetId, targetName, showelse toast.warning(t('app.protectionPanel.remoteCopyCouldNotBeVerified', 'Remote copy could not be verified'));load();} catch (err) {- toast.error(err.message || t('app.protectionPanel.verificationFailed', 'Verification failed'));+ toastError(toast, t('app.protectionPanel.verificationFailed', 'Verification failed'), err);}}, [targetType, targetId, toast, t, load]);@@ -199,7 +200,7 @@ export default function ProtectionPanel({ targetType, targetId, targetName, showif (detailRun?.id === run.id) setDetailRun(null);load();} catch (err) {- toast.error(err.message || t('app.protectionPanel.failedToDeleteBackup', 'Failed to delete backup'));+ toastError(toast, t('app.protectionPanel.failedToDeleteBackup', 'Failed to delete backup'), err);}}, [confirm, t, targetType, targetId, toast, detailRun?.id, load]);diff --git a/frontend/src/components/databases/AdminerSsoButton.jsx b/frontend/src/components/databases/AdminerSsoButton.jsxindex eb245ae4..0c6543c8 100644--- a/frontend/src/components/databases/AdminerSsoButton.jsx+++ b/frontend/src/components/databases/AdminerSsoButton.jsx@@ -4,6 +4,7 @@ import api from '../../services/api';import { useToast } from '../../contexts/useToast.js';import { Button } from '@/components/ui/button';import { useTranslation } from 'react-i18next';+import { toastError } from '@/utils/errorMessage';// Adminer accepts a plain form POST into its login screen; submitting the// descriptor from a hidden form means the single-use password never touches@@ -49,7 +50,7 @@ export default function AdminerSsoButton({ databaseId, disabled = false }) {postToAdminer(descriptor);toast.success(t('app.adminerSsoButton.openedAdminerWithA5Minute', 'Opened Adminer with a 5-minute scoped credential'));} catch (err) {- toast.error(err.message || t('app.adminerSsoButton.failedToLaunchAdminer', 'Failed to launch Adminer'));+ toastError(toast, t('app.adminerSsoButton.failedToLaunchAdminer', 'Failed to launch Adminer'), err);} finally {setBusy(false);}diff --git a/frontend/src/components/databases/ConfigTunerPanel.jsx b/frontend/src/components/databases/ConfigTunerPanel.jsxindex ed8a5b4d..83499a49 100644--- a/frontend/src/components/databases/ConfigTunerPanel.jsx+++ b/frontend/src/components/databases/ConfigTunerPanel.jsx@@ -5,6 +5,7 @@ import { useToast } from '../../contexts/useToast.js';import { useConfirm } from '../../hooks/useConfirm';import { Button } from '@/components/ui/button';import { useTranslation } from 'react-i18next';+import { toastError } from '@/utils/errorMessage';// Curated config tuner: a small set of vetted engine settings with RAM-aware// suggested values. Shows current vs suggested; the operator picks which@@ -91,7 +92,7 @@ export default function ConfigTunerPanel({ target, engine, user, password }) {toast.success(t('app.configTunerPanel.settingsAppliedAndEngineRestarted', 'Settings applied and engine restarted'));await load(dedicated);} catch (err) {- toast.error(err.message || t('app.configTunerPanel.failedToApplySettings', 'Failed to apply settings'));+ toastError(toast, t('app.configTunerPanel.failedToApplySettings', 'Failed to apply settings'), err);} finally {setBusy(false);}@@ -112,7 +113,7 @@ export default function ConfigTunerPanel({ target, engine, user, password }) {toast.success(t('app.configTunerPanel.previousConfigurationRestored', 'Previous configuration restored'));await load(dedicated);} catch (err) {- toast.error(err.message || t('app.configTunerPanel.rollbackFailed', 'Rollback failed'));+ toastError(toast, t('app.configTunerPanel.rollbackFailed', 'Rollback failed'), err);} finally {setBusy(false);}diff --git a/frontend/src/components/databases/DbUsersPanel.jsx b/frontend/src/components/databases/DbUsersPanel.jsxindex edbd26d0..575437ed 100644--- a/frontend/src/components/databases/DbUsersPanel.jsx+++ b/frontend/src/components/databases/DbUsersPanel.jsx@@ -6,6 +6,7 @@ import { useConfirm } from '../../hooks/useConfirm';import { Button } from '@/components/ui/button';import CopyField from '@/components/CopyField';import { useTranslation } from 'react-i18next';+import { toastError } from '@/utils/errorMessage';// Users ServerKit created on a managed database (tracked rows merged with the// live engine list). Create returns the password exactly once — it is shown@@ -27,7 +28,7 @@ export default function DbUsersPanel({ databaseId }) {const data = await api.getManagedDbUsers(databaseId);setUsers(data?.users || []);} catch (err) {- toast.error(err.message || t('app.dbUsersPanel.failedToLoadDatabaseUsers', 'Failed to load database users'));+ toastError(toast, t('app.dbUsersPanel.failedToLoadDatabaseUsers', 'Failed to load database users'), err);} finally {setLoading(false);}@@ -49,7 +50,7 @@ export default function DbUsersPanel({ databaseId }) {setNewGrants('ALL');await load();} catch (err) {- toast.error(err.message || t('app.dbUsersPanel.failedToCreateUser', 'Failed to create user'));+ toastError(toast, t('app.dbUsersPanel.failedToCreateUser', 'Failed to create user'), err);} finally {setCreating(false);}@@ -68,7 +69,7 @@ export default function DbUsersPanel({ databaseId }) {toast.success(t('app.dbUsersPanel.userDropped', 'User dropped'));await load();} catch (err) {- toast.error(err.message || t('app.dbUsersPanel.failedToDropUser', 'Failed to drop user'));+ toastError(toast, t('app.dbUsersPanel.failedToDropUser', 'Failed to drop user'), err);}}diff --git a/frontend/src/components/databases/EngineCatalogDrawer.jsx b/frontend/src/components/databases/EngineCatalogDrawer.jsxindex 35f25cc9..f4d941ad 100644--- a/frontend/src/components/databases/EngineCatalogDrawer.jsx+++ b/frontend/src/components/databases/EngineCatalogDrawer.jsx@@ -14,6 +14,7 @@ import {formatMemory,} from './engineHelpers';import { Button as SharedButton } from '@/components/ui/button';+import { toastError } from '@/utils/errorMessage';// "Add a database engine" — the browse half of the install flow.//@@ -161,7 +162,7 @@ export default function EngineCatalogDrawer({toast.success(t('app.engineCatalogDrawer.templateRepositoriesSynced', 'Template repositories synced'));await onSynced?.();} catch (err) {- toast.error(err.message || t('app.engineCatalogDrawer.couldNotSyncTemplateRepositories', 'Could not sync template repositories'));+ toastError(toast, t('app.engineCatalogDrawer.couldNotSyncTemplateRepositories', 'Could not sync template repositories'), err);} finally {setSyncing(false);}diff --git a/frontend/src/components/databases/InsightsPanel.jsx b/frontend/src/components/databases/InsightsPanel.jsxindex b7982a45..8532a60f 100644--- a/frontend/src/components/databases/InsightsPanel.jsx+++ b/frontend/src/components/databases/InsightsPanel.jsx@@ -6,6 +6,7 @@ import { useToast } from '../../contexts/useToast.js';import { useConfirm } from '../../hooks/useConfirm';import { Button } from '@/components/ui/button';import { formatNumber, formatPercent } from '@/utils/intl';+import { toastError } from '@/utils/errorMessage';const QUERY_PREVIEW_LEN = 160;@@ -57,7 +58,7 @@ export default function InsightsPanel({ conn, engine, isAdmin }) {toast.success(t('app.dbInsights.enabled', 'pg_stat_statements is on. Queries show up as they run.'));await load();} catch (err) {- toast.error(err.message);+ toastError(toast, t('app.dbInsights.couldntEnableStatements', "Couldn't turn on pg_stat_statements."), err);} finally {setEnabling(false);}diff --git a/frontend/src/components/databases/ManagedDatabasesPanel.jsx b/frontend/src/components/databases/ManagedDatabasesPanel.jsxindex 2a10f8b4..a6a1823b 100644--- a/frontend/src/components/databases/ManagedDatabasesPanel.jsx+++ b/frontend/src/components/databases/ManagedDatabasesPanel.jsx@@ -9,6 +9,7 @@ import AdminerSsoButton from './AdminerSsoButton';import DbUsersPanel from './DbUsersPanel';import { useClipboard } from '@/hooks/useClipboard';import { useTranslation } from 'react-i18next';+import { toastError } from '@/utils/errorMessage';// Durable list of the databases ServerKit tracks (provisioned or adopted),// beside the live explorer. Reveal/copy a real connection string (audited),@@ -29,7 +30,7 @@ export default function ManagedDatabasesPanel() {const data = await api.getManagedDatabases();setRows(data?.databases || []);} catch (err) {- toast.error(err.message || t('app.managedDatabasesPanel.failedToLoadManagedDatabases', 'Failed to load managed databases'));+ toastError(toast, t('app.managedDatabasesPanel.failedToLoadManagedDatabases', 'Failed to load managed databases'), err);} finally {setLoading(false);}@@ -48,7 +49,7 @@ export default function ManagedDatabasesPanel() {toast.info(uri);}} catch (err) {- toast.error(err.message || t('app.managedDatabasesPanel.failedToRevealConnectionString', 'Failed to reveal connection string'));+ toastError(toast, t('app.managedDatabasesPanel.failedToRevealConnectionString', 'Failed to reveal connection string'), err);} finally {setBusyId(null);}@@ -60,7 +61,7 @@ export default function ManagedDatabasesPanel() {await api.protectManagedDatabase(row.id);toast.success(t('app.managedDatabasesPanel.backupPolicyCreatedTuneItUnder', 'Backup policy created. Tune it under Backups.'));} catch (err) {- toast.error(err.message || t('app.managedDatabasesPanel.failedToProtectDatabase', 'Failed to protect database'));+ toastError(toast, t('app.managedDatabasesPanel.failedToProtectDatabase', 'Failed to protect database'), err);} finally {setBusyId(null);}@@ -82,7 +83,7 @@ export default function ManagedDatabasesPanel() {toast.success(drop ? t('app.managedDatabasesPanel.databaseDroppedAndUntracked', 'Database dropped and untracked') : t('app.managedDatabasesPanel.databaseUntracked', 'Database untracked'));await load();} catch (err) {- toast.error(err.message || t('app.managedDatabasesPanel.failedToRemoveDatabase', 'Failed to delete database'));+ toastError(toast, t('app.managedDatabasesPanel.failedToRemoveDatabase', 'Failed to delete database'), err);} finally {setBusyId(null);}diff --git a/frontend/src/components/databases/ProcessListPanel.jsx b/frontend/src/components/databases/ProcessListPanel.jsxindex d44547bd..7f30f493 100644--- a/frontend/src/components/databases/ProcessListPanel.jsx+++ b/frontend/src/components/databases/ProcessListPanel.jsx@@ -14,6 +14,7 @@ import { useTableSort } from '@/hooks/useTableSort';import { useColumnVisibility } from '@/hooks/useColumnVisibility';import { useTranslation } from 'react-i18next';import { Button as SharedButton } from '@/components/ui/button';+import { toastError } from '@/utils/errorMessage';const REFRESH_MS = 5000;const QUERY_PREVIEW_LEN = 120;@@ -142,7 +143,7 @@ export default function ProcessListPanel({ conn, engine, active, isAdmin }) {toast.success(t('app.processListPanel.process2', 'Process {{id}} {{value}}', { id: proc.id, value: engineKind === 'postgresql' ? 'terminated' : 'killed' }));load(true);} catch (err) {- toast.error(err.message || t('app.processListPanel.failedToProcess', 'Failed to {{value}} process {{id}}', { value: verb.toLowerCase(), id: proc.id }));+ toastError(toast, t('app.processListPanel.failedToProcess', 'Failed to {{value}} process {{id}}', { value: verb.toLowerCase(), id: proc.id }), err);} finally {setKilling(null);}diff --git a/frontend/src/components/deployments/ConfigDiffModal.jsx b/frontend/src/components/deployments/ConfigDiffModal.jsxindex 6de9a8d4..cc67d3ae 100644--- a/frontend/src/components/deployments/ConfigDiffModal.jsx+++ b/frontend/src/components/deployments/ConfigDiffModal.jsx@@ -7,6 +7,7 @@ import { Pill } from '@/components/ds';import { useToast } from '../../contexts/useToast.js';import { useConfirm } from '../../hooks/useConfirm';import { useTranslation } from 'react-i18next';+import { toastError } from '@/utils/errorMessage';function displayValue(value, notSet) {if (value === null || value === undefined || value === '') return notSet;@@ -231,10 +232,10 @@ const ConfigDiffModal = ({: t('app.configDiffModal.configurationRestoredRedeployTriggered', 'Configuration restored. Redeploy triggered.'));onRestored?.(res);} else {- toast.error(res.error || t('app.configDiffModal.restoreFailed', 'Restore failed'));+ toastError(toast, t('app.configDiffModal.restoreFailed', 'Restore failed'), res.error);}} catch (err) {- toast.error(err.message);+ toastError(toast, t('app.configDiffModal.restoreFailed', 'Restore failed'), err);} finally {setRestoring(false);}diff --git a/frontend/src/components/docker/ComposeTab.jsx b/frontend/src/components/docker/ComposeTab.jsxindex 3b275061..f2c85da3 100644--- a/frontend/src/components/docker/ComposeTab.jsx+++ b/frontend/src/components/docker/ComposeTab.jsx@@ -20,6 +20,7 @@ import {unwrapRemoteData,normalizeListResponse,} from './dockerHelpers';+import { toastError } from '@/utils/errorMessage';// `docker compose ls --format json` capitalises its keys; the label-scanning// fallback in docker_service builds the same shape by hand. Read through one@@ -176,7 +177,7 @@ const ComposeTab = ({ onStatsChange }) => {onStatsChange?.();} catch (err) {console.error(`Failed to ${action} project:`, err);- toast.error(err.message || t('app.composeTab.failedToProject', 'Failed to {{action}} compose project', { action: action }));+ toastError(toast, t('app.composeTab.failedToProject', 'Failed to {{action}} compose project', { action: action }), err);} finally {setActionLoading(prev => ({ ...prev, [name]: false }));}diff --git a/frontend/src/components/docker/ContainersTab.jsx b/frontend/src/components/docker/ContainersTab.jsxindex e96936cb..9164b444 100644--- a/frontend/src/components/docker/ContainersTab.jsx+++ b/frontend/src/components/docker/ContainersTab.jsx@@ -46,6 +46,7 @@ import { ContainerResourceBars } from './dockerShared';import { downloadBlob } from '@/utils/downloadBlob';import { usePolling } from '@/hooks/usePolling';import { useTranslation } from 'react-i18next';+import { toastError } from '@/utils/errorMessage';// Container stats cadence.const STATS_REFRESH_MS = 10000;@@ -365,7 +366,7 @@ const ContainersTab = ({ onStatsChange }) => {onStatsChange?.();} catch (err) {console.error(`Failed to ${action} container:`, err);- toast.error(err.message || t('app.containersTab.failedToContainer', 'Failed to {{action}} container', { action: action }));+ toastError(toast, t('app.containersTab.failedToContainer', 'Failed to {{action}} container', { action: action }), err);}}diff --git a/frontend/src/components/docker/ImagesTab.jsx b/frontend/src/components/docker/ImagesTab.jsxindex a9fa4089..8186a438 100644--- a/frontend/src/components/docker/ImagesTab.jsx+++ b/frontend/src/components/docker/ImagesTab.jsx@@ -21,6 +21,7 @@ import {useServer,normalizeListResponse,} from './dockerHelpers';+import { toastError } from '@/utils/errorMessage';export const PullImageButton = () => {const { t } = useTranslation();@@ -213,7 +214,7 @@ const ImagesTab = ({ onStatsChange }) => {onStatsChange?.();} catch (err) {console.error('Failed to remove image:', err);- toast.error(t('app.imagesTab.failedToRemoveImageItMay', 'Failed to delete image. It may be in use by a container.'));+ toastError(toast, t('app.imagesTab.failedToRemoveImageItMay', 'Failed to delete image. It may be in use by a container.'), err);}}diff --git a/frontend/src/components/docker/NetworksTab.jsx b/frontend/src/components/docker/NetworksTab.jsxindex 2aa275bd..4e28971b 100644--- a/frontend/src/components/docker/NetworksTab.jsx+++ b/frontend/src/components/docker/NetworksTab.jsx@@ -20,6 +20,7 @@ import {normalizeListResponse,shortId,} from './dockerHelpers';+import { toastError } from '@/utils/errorMessage';export const CreateNetworkButton = () => {const { t } = useTranslation();@@ -150,7 +151,7 @@ const NetworksTab = ({ onStatsChange }) => {onStatsChange?.();} catch (err) {console.error('Failed to remove network:', err);- toast.error(t('app.networksTab.failedToRemoveNetworkItMay', 'Failed to delete network. It may be in use.'));+ toastError(toast, t('app.networksTab.failedToRemoveNetworkItMay', 'Failed to delete network. It may be in use.'), err);}}diff --git a/frontend/src/components/docker/PruneButton.jsx b/frontend/src/components/docker/PruneButton.jsxindex 726c4149..0b48ef81 100644--- a/frontend/src/components/docker/PruneButton.jsx+++ b/frontend/src/components/docker/PruneButton.jsx@@ -5,6 +5,7 @@ import { useConfirm } from '../../hooks/useConfirm';import { Button } from '@/components/ui/button';import { useServer } from './dockerHelpers';import { useTranslation } from 'react-i18next';+import { toastError } from '@/utils/errorMessage';const PruneButton = ({ onPruned }) => {const { t } = useTranslation();@@ -26,8 +27,8 @@ const PruneButton = ({ onPruned }) => {await api.request('/docker/cleanup', { method: 'POST', body: {} });toast.success(t('app.pruneButton.dockerCleanupCompleted', 'Docker cleanup completed'));onPruned?.();- } catch {- toast.error(t('app.pruneButton.failedToCleanupDockerResources', 'Failed to cleanup Docker resources'));+ } catch (err) {+ toastError(toast, t('app.pruneButton.failedToCleanupDockerResources', 'Failed to cleanup Docker resources'), err);} finally {setLoading(false);}diff --git a/frontend/src/components/docker/VolumesTab.jsx b/frontend/src/components/docker/VolumesTab.jsxindex a6609405..41de9f3c 100644--- a/frontend/src/components/docker/VolumesTab.jsx+++ b/frontend/src/components/docker/VolumesTab.jsx@@ -19,6 +19,7 @@ import {useServer,normalizeListResponse,} from './dockerHelpers';+import { toastError } from '@/utils/errorMessage';export const CreateVolumeButton = () => {const { t } = useTranslation();@@ -154,7 +155,7 @@ const VolumesTab = ({ onStatsChange }) => {onStatsChange?.();} catch (err) {console.error('Failed to remove volume:', err);- toast.error(t('app.volumesTab.failedToRemoveVolumeItMay', 'Failed to delete volume. It may be in use.'));+ toastError(toast, t('app.volumesTab.failedToRemoveVolumeItMay', 'Failed to delete volume. It may be in use.'), err);}}diff --git a/frontend/src/components/domains/DomainDnsPanel.jsx b/frontend/src/components/domains/DomainDnsPanel.jsxindex 8c52d27f..313567e8 100644--- a/frontend/src/components/domains/DomainDnsPanel.jsx+++ b/frontend/src/components/domains/DomainDnsPanel.jsx@@ -22,6 +22,7 @@ import { useTranslation } from 'react-i18next';import {Select, SelectTrigger, SelectContent, SelectItem, SelectValue,} from '@/components/ui/select';+import { toastError } from '@/utils/errorMessage';const RECORD_TYPES = ['A', 'AAAA', 'CNAME', 'MX', 'TXT', 'SRV', 'CAA', 'NS'];const PROXYABLE = ['A', 'AAAA', 'CNAME'];@@ -152,7 +153,7 @@ export default function DomainDnsPanel({ domain, isAdmin }) {setForm(EMPTY_FORM);await load();} catch (e) {- toast.error(e.message || t('app.domainDnsPanel.failedToAddRecord', 'Failed to add record'));+ toastError(toast, t('app.domainDnsPanel.failedToAddRecord', 'Failed to add record'), e);} finally {setSaving(false);}@@ -168,7 +169,7 @@ export default function DomainDnsPanel({ domain, isAdmin }) {toast.success(t('app.domainDnsPanel.dynamicDnsEnabled', 'Dynamic DNS enabled'));await loadHosts();} catch (e) {- toast.error(e.message || t('app.domainDnsPanel.failedToEnableDynamicDns', 'Failed to enable dynamic DNS'));+ toastError(toast, t('app.domainDnsPanel.failedToEnableDynamicDns', 'Failed to enable dynamic DNS'), e);} finally {setBusyKey(null);}@@ -181,7 +182,7 @@ export default function DomainDnsPanel({ domain, isAdmin }) {toast.success(t('app.domainDnsPanel.tokenRegenerated', 'Token regenerated'));await loadHosts();} catch (e) {- toast.error(e.message || t('app.domainDnsPanel.failedToRegenerateToken', 'Failed to regenerate token'));+ toastError(toast, t('app.domainDnsPanel.failedToRegenerateToken', 'Failed to regenerate token'), e);}}@@ -197,7 +198,7 @@ export default function DomainDnsPanel({ domain, isAdmin }) {toast.success(t('app.domainDnsPanel.dynamicDnsDisabled', 'Dynamic DNS disabled'));await loadHosts();} catch (e) {- toast.error(e.message || t('app.domainDnsPanel.failedToDisableDynamicDns', 'Failed to disable dynamic DNS'));+ toastError(toast, t('app.domainDnsPanel.failedToDisableDynamicDns', 'Failed to disable dynamic DNS'), e);}}@@ -209,7 +210,7 @@ export default function DomainDnsPanel({ domain, isAdmin }) {const data = await api.exportDNSZone(zid);downloadBlob(data.zone_file || '', `${domain.name}.txt`);} catch (e) {- toast.error(e.message || t('app.domainDnsPanel.exportFailed', 'Export failed'));+ toastError(toast, t('app.domainDnsPanel.exportFailed', 'Export failed'), e);} finally {setExporting(false);}@@ -223,7 +224,7 @@ export default function DomainDnsPanel({ domain, isAdmin }) {const d = await api.checkDNSPropagation(domain.name);setPropResults(d.results || []);} catch (e) {- toast.error(e.message || t('app.domainDnsPanel.propagationCheckFailed', 'Propagation check failed'));+ toastError(toast, t('app.domainDnsPanel.propagationCheckFailed', 'Propagation check failed'), e);setPropResults([]);} finally {setPropLoading(false);@@ -235,7 +236,7 @@ export default function DomainDnsPanel({ domain, isAdmin }) {const zid = await ensureZone();navigate(`/cloudflare/zones/${zid}`);} catch (e) {- toast.error(e.message || t('app.domainDnsPanel.couldNotOpenCloudflare', 'Could not open Cloudflare'));+ toastError(toast, t('app.domainDnsPanel.couldNotOpenCloudflare', 'Could not open Cloudflare'), e);}}diff --git a/frontend/src/components/ds/ViewMenu.jsx b/frontend/src/components/ds/ViewMenu.jsxindex 9ec2ae12..f7bf0a3b 100644--- a/frontend/src/components/ds/ViewMenu.jsx+++ b/frontend/src/components/ds/ViewMenu.jsx@@ -5,6 +5,7 @@ import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popoverimport { cn } from '@/lib/utils';import { useToast } from '@/contexts/useToast.js';import { useTranslation } from 'react-i18next';+import { toastError } from '@/utils/errorMessage';// Saved-view picker (CRM style: Twenty view switcher / Frappe view dropdown).// Lists built-in views plus the user's saved views for the page; clicking a@@ -34,7 +35,7 @@ export function ViewMenu({ views, className }) {setName('');toast.success(t('app.viewMenu.viewSaved', 'View "{{trimmed}}" saved', { trimmed: trimmed }));} catch (err) {- toast.error(err?.data?.error || err?.message || t('app.viewMenu.couldNotSaveTheView', 'Could not save the view'));+ toastError(toast, t('app.viewMenu.couldNotSaveTheView', 'Could not save the view'), err);} finally {setSaving(false);}@@ -45,7 +46,7 @@ export function ViewMenu({ views, className }) {await updateActiveView();toast.success(t('app.viewMenu.viewUpdated', 'View "{{name}}" updated', { name: activeView.name }));} catch (err) {- toast.error(err?.data?.error || err?.message || t('app.viewMenu.couldNotUpdateTheView', 'Could not update the view'));+ toastError(toast, t('app.viewMenu.couldNotUpdateTheView', 'Could not update the view'), err);}};@@ -54,7 +55,7 @@ export function ViewMenu({ views, className }) {await removeView(view);toast.success(t('app.viewMenu.viewDeleted', 'View "{{name}}" deleted', { name: view.name }));} catch (err) {- toast.error(err?.data?.error || err?.message || t('app.viewMenu.couldNotDeleteTheView', 'Could not delete the view'));+ toastError(toast, t('app.viewMenu.couldNotDeleteTheView', 'Could not delete the view'), err);}};diff --git a/frontend/src/components/marketplace/ManualInstallModal.jsx b/frontend/src/components/marketplace/ManualInstallModal.jsxindex b87dadc8..9cf22d7c 100644--- a/frontend/src/components/marketplace/ManualInstallModal.jsx+++ b/frontend/src/components/marketplace/ManualInstallModal.jsx@@ -17,6 +17,7 @@ import { Input } from '@/components/ui/input';import { Badge } from '@/components/ui/badge';import DocsLink from '@/components/DocsLink';import { useTranslation } from 'react-i18next';+import { toastError } from '@/utils/errorMessage';const INSTALL_SOURCES = [{ id: 'url', label: 'URL', icon: Globe2 },@@ -214,7 +215,7 @@ const ManualInstallModal = ({ defaultSource = 'url', onClose, onInstalled }) =>const result = await api.previewPlugin(pluginUrl.trim());setPreview(result);} catch (err) {- toast.error(err.message || t('app.manualInstallModal.couldNotResolveThatExtension', 'Could not resolve that extension'));+ toastError(toast, t('app.manualInstallModal.couldNotResolveThatExtension', 'Could not resolve that extension'), err);} finally {setPreviewing(false);}@@ -230,7 +231,7 @@ const ManualInstallModal = ({ defaultSource = 'url', onClose, onInstalled }) =>toast.success(t('app.manualInstallModal.extensionInstalledRestartBackendToActivate', 'Extension "{{displayname}}" installed. Restart backend to activate routes.', { displayname: result.display_name }));onInstalled();} catch (err) {- toast.error(err.message || t('app.manualInstallModal.extensionInstallationFailed', 'Extension installation failed'));+ toastError(toast, t('app.manualInstallModal.extensionInstallationFailed', 'Extension installation failed'), err);} finally {setInstalling(false);}@@ -254,7 +255,7 @@ const ManualInstallModal = ({ defaultSource = 'url', onClose, onInstalled }) =>toast.success(t('app.manualInstallModal.extensionInstalledRestartBackendToActivate', 'Extension "{{displayname}}" installed. Restart backend to activate routes.', { displayname: result.display_name }));onInstalled();} catch (err) {- toast.error(err.message || t('app.manualInstallModal.extensionInstallationFailed', 'Extension installation failed'));+ toastError(toast, t('app.manualInstallModal.extensionInstallationFailed', 'Extension installation failed'), err);} finally {setInstalling(false);}diff --git a/frontend/src/components/monitoring/DiskReclaimModal.jsx b/frontend/src/components/monitoring/DiskReclaimModal.jsxindex bc1314bb..fb7ccae5 100644--- a/frontend/src/components/monitoring/DiskReclaimModal.jsx+++ b/frontend/src/components/monitoring/DiskReclaimModal.jsx@@ -7,6 +7,7 @@ import { Button } from '@/components/ui/button';import { useToast } from '@/contexts/useToast.js';import { useOperations } from '@/contexts/OperationsContext';import formatBytes from '@/utils/formatBytes';+import { toastError } from '@/utils/errorMessage';/*** Curated "safe" disk reclaim. Shows what a fresh measurement says can be@@ -69,7 +70,7 @@ const DiskReclaimModal = ({ open, onClose }) => {);onClose();} catch (err) {- toast.error(err.message || t('app.diskReclaim.reclaimFailed', 'Reclaim failed'));+ toastError(toast, t('app.diskReclaim.reclaimFailed', 'Reclaim failed'), err);setRunning(false);}};diff --git a/frontend/src/components/monitoring/DoctorPanel.jsx b/frontend/src/components/monitoring/DoctorPanel.jsxindex a690eb0e..03da7775 100644--- a/frontend/src/components/monitoring/DoctorPanel.jsx+++ b/frontend/src/components/monitoring/DoctorPanel.jsx@@ -11,6 +11,7 @@ import { usePolling } from '@/hooks/usePolling';import { useTranslation } from 'react-i18next';import { useOperations } from '@/contexts/OperationsContext';import DiskReclaimModal from './DiskReclaimModal';+import { toastError } from '@/utils/errorMessage';// The fleet sweep fans out across agents over the network, so it is a job@@ -116,7 +117,7 @@ const DoctorPanel = () => {bad > 0 ? `Diagnosis finished — ${bad} finding${bad !== 1 ? 's' : ''}` : 'Diagnosis finished — all clear');} catch (err) {- toast.error(err.message || t('app.doctorPanel.diagnosisFailed', 'Diagnosis failed'));+ toastError(toast, t('app.doctorPanel.diagnosisFailed', 'Diagnosis failed'), err);} finally {setRunning(false);}@@ -137,7 +138,7 @@ const DoctorPanel = () => {await loadFleet();toast.success(t('app.doctorPanel.fleetSweepFinished', 'Fleet sweep finished'));} else {- toast.error(job.error_message || t('app.doctorPanel.fleetSweepDidNotFinish', 'Fleet sweep did not finish'));+ toastError(toast, t('app.doctorPanel.fleetSweepDidNotFinish', 'Fleet sweep did not finish'), job.error_message);}} catch {// Transient poll failure — the next tick retries.@@ -152,7 +153,7 @@ const DoctorPanel = () => {pollSweep(res.job_id);} catch (err) {setSweeping(false);- toast.error(err.message || t('app.doctorPanel.couldNotQueueTheFleetSweep', 'Could not queue the fleet sweep'));+ toastError(toast, t('app.doctorPanel.couldNotQueueTheFleetSweep', 'Could not queue the fleet sweep'), err);}};@@ -199,7 +200,7 @@ const DoctorPanel = () => {setReport(fresh.report);}} catch (err) {- toast.error(err.message || t('app.doctorPanel.repairFailed2', 'Repair failed'));+ toastError(toast, t('app.doctorPanel.repairFailed2', 'Repair failed'), err);} finally {setRepairing(false);setConfirm(null);diff --git a/frontend/src/components/monitoring/FleetCapacityPanel.jsx b/frontend/src/components/monitoring/FleetCapacityPanel.jsxindex f5ead9e6..74b163a2 100644--- a/frontend/src/components/monitoring/FleetCapacityPanel.jsx+++ b/frontend/src/components/monitoring/FleetCapacityPanel.jsx@@ -13,6 +13,7 @@ import ServerPicker from '@/components/ServerPicker';import { CHART_COLORS, METRIC_LABELS } from './fleetMetrics';import { downloadBlob } from '@/utils/downloadBlob';import { useTranslation } from 'react-i18next';+import { toastError } from '@/utils/errorMessage';// The three fleet-wide questions that only make sense across servers: how do// these boxes compare, which one is behaving unlike itself, and when does a@@ -66,8 +67,8 @@ export default function FleetCapacityPanel({ scope, refreshKey = 0 }) {setComparing(true);try {setCompData(await api.getFleetComparison(selectedServers, compMetric, compPeriod));- } catch {- toast.error(t('app.fleetCapacityPanel.failedToLoadComparisonData', 'Failed to load comparison data'));+ } catch (err) {+ toastError(toast, t('app.fleetCapacityPanel.failedToLoadComparisonData', 'Failed to load comparison data'), err);} finally {setComparing(false);}@@ -77,8 +78,8 @@ export default function FleetCapacityPanel({ scope, refreshKey = 0 }) {if (!forecastServer) return;try {setForecast(await api.getCapacityForecast(forecastServer, forecastMetric));- } catch {- toast.error(t('app.fleetCapacityPanel.failedToLoadForecast', 'Failed to load forecast'));+ } catch (err) {+ toastError(toast, t('app.fleetCapacityPanel.failedToLoadForecast', 'Failed to load forecast'), err);}};@@ -87,8 +88,8 @@ export default function FleetCapacityPanel({ scope, refreshKey = 0 }) {try {const blob = await api.exportFleetCsv(selectedServers, compMetric, compPeriod);downloadBlob(blob, `fleet_${compMetric}_${compPeriod}.csv`);- } catch {- toast.error(t('app.fleetCapacityPanel.exportFailed', 'Export failed'));+ } catch (err) {+ toastError(toast, t('app.fleetCapacityPanel.exportFailed', 'Export failed'), err);}};diff --git a/frontend/src/components/monitoring/FleetThresholdsPanel.jsx b/frontend/src/components/monitoring/FleetThresholdsPanel.jsxindex 395dc5b6..325345b4 100644--- a/frontend/src/components/monitoring/FleetThresholdsPanel.jsx+++ b/frontend/src/components/monitoring/FleetThresholdsPanel.jsx@@ -16,6 +16,7 @@ import { useTableSort } from '@/hooks/useTableSort';import { useColumnVisibility } from '@/hooks/useColumnVisibility';import { METRIC_LABELS } from './fleetMetrics';import { useTranslation } from 'react-i18next';+import { toastError } from '@/utils/errorMessage';const DEFAULT_THRESHOLD = {metric: 'cpu',@@ -52,8 +53,8 @@ export default function FleetThresholdsPanel({ refreshKey = 0 }) {setDraft(DEFAULT_THRESHOLD);setAdding(false);reload();- } catch {- toast.error(t('app.fleetThresholdsPanel.failedToSaveThreshold', 'Failed to save threshold'));+ } catch (err) {+ toastError(toast, t('app.fleetThresholdsPanel.failedToSaveThreshold', 'Failed to save threshold'), err);}};@@ -61,8 +62,8 @@ export default function FleetThresholdsPanel({ refreshKey = 0 }) {try {await api.deleteFleetThreshold(id);reload();- } catch {- toast.error(t('app.fleetThresholdsPanel.failedToDeleteThreshold', 'Failed to delete threshold'));+ } catch (err) {+ toastError(toast, t('app.fleetThresholdsPanel.failedToDeleteThreshold', 'Failed to delete threshold'), err);}};diff --git a/frontend/src/components/previews/PreviewList.jsx b/frontend/src/components/previews/PreviewList.jsxindex 0eef4248..f9154c3c 100644--- a/frontend/src/components/previews/PreviewList.jsx+++ b/frontend/src/components/previews/PreviewList.jsx@@ -12,6 +12,7 @@ import { Input } from '@/components/ui/input';import { Label } from '@/components/ui/label';import { Switch } from '@/components/ui/switch';import { useTranslation } from 'react-i18next';+import { toastError } from '@/utils/errorMessage';const DEFAULT_TEMPLATE = 'pr-{pr_number}.{app_domain}';@@ -39,7 +40,7 @@ const PreviewList = ({ appId }) => {setTemplate(conf?.domain_template || DEFAULT_TEMPLATE);} catch (err) {console.error('Failed to load previews:', err);- toast?.error?.(t('app.previewList.couldNotLoadPrPreviews', 'Could not load PR previews'));+ toastError(toast, t('app.previewList.couldNotLoadPrPreviews', 'Could not load PR previews'), err);} finally {setLoading(false);}@@ -56,7 +57,7 @@ const PreviewList = ({ appId }) => {toast?.success?.(t('app.previewList.previewSettingsSaved', 'Preview settings saved'));} catch (err) {console.error('Failed to save preview settings:', err);- toast?.error?.(err.message || t('app.previewList.couldNotSaveSettings', 'Could not save settings'));+ toastError(toast, t('app.previewList.couldNotSaveSettings', 'Could not save settings'), err);} finally {setSaving(false);}@@ -77,7 +78,7 @@ const PreviewList = ({ appId }) => {toast?.success?.(t('app.previewList.reconciledPreviewsAgainstOpenPrs', 'Reconciled previews against open PRs'));await load();} catch (err) {- toast?.error?.(err.message || t('app.previewList.syncFailed', 'Sync failed'));+ toastError(toast, t('app.previewList.syncFailed', 'Sync failed'), err);} finally {setSyncing(false);}@@ -90,7 +91,7 @@ const PreviewList = ({ appId }) => {toast?.success?.(t('app.previewList.redeployingPreviewForPr', 'Redeploying preview for PR #{{prnumber}}', { prnumber: preview.pr_number }));await load();} catch (err) {- toast?.error?.(err.message || t('app.previewList.redeployFailed', 'Redeploy failed'));+ toastError(toast, t('app.previewList.redeployFailed', 'Redeploy failed'), err);} finally {setBusyId(null);}@@ -110,7 +111,7 @@ const PreviewList = ({ appId }) => {toast?.success?.(t('app.previewList.previewForPrDestroyed', 'Preview for PR #{{prnumber}} deleted', { prnumber: preview.pr_number }));await load();} catch (err) {- toast?.error?.(err.message || t('app.previewList.destroyFailed', 'Delete failed'));+ toastError(toast, t('app.previewList.destroyFailed', 'Delete failed'), err);} finally {setBusyId(null);}diff --git a/frontend/src/components/proxy/ProxyStackPanel.jsx b/frontend/src/components/proxy/ProxyStackPanel.jsxindex 9c152814..949c3033 100644--- a/frontend/src/components/proxy/ProxyStackPanel.jsx+++ b/frontend/src/components/proxy/ProxyStackPanel.jsx@@ -8,6 +8,7 @@ import { Pill, SegControl, serviceStatusKind } from '../ds';import EmptyState from '../EmptyState';import { AlertTriangle, CheckCircle2, Network } from 'lucide-react';import { useTranslation } from 'react-i18next';+import { toastError } from '@/utils/errorMessage';// Human label for an ingress plane, used in the mismatch banner copy.const PLANE_LABEL = {@@ -107,7 +108,7 @@ const ProxyStackPanel = ({ serverId }) => {await load();await loadAudit();} catch (err) {- toast.error(err.message || t('app.proxyStackPanel.failedToSwitchProxy', 'Failed to switch proxy'));+ toastError(toast, t('app.proxyStackPanel.failedToSwitchProxy', 'Failed to switch proxy'), err);} finally {setBusy(false);}@@ -120,7 +121,7 @@ const ProxyStackPanel = ({ serverId }) => {toast.success(t('app.proxyStackPanel.customSnippetSaved', 'Custom snippet saved'));await load();} catch (err) {- toast.error(err.message || t('app.proxyStackPanel.failedToSaveSnippet', 'Failed to save snippet'));+ toastError(toast, t('app.proxyStackPanel.failedToSaveSnippet', 'Failed to save snippet'), err);} finally {setBusy(false);}@@ -133,12 +134,12 @@ const ProxyStackPanel = ({ serverId }) => {if (res.success) {toast.success(res.reloaded ? t('app.proxyStackPanel.configRegeneratedAndReloaded', 'Config regenerated and reloaded') : t('app.proxyStackPanel.configRegenerated', 'Config regenerated'));} else {- toast.error(res.error || t('app.proxyStackPanel.regenerateFailed', 'Regenerate failed'));+ toastError(toast, t('app.proxyStackPanel.regenerateFailed', 'Regenerate failed'), res.error);}await load();await loadAudit();} catch (err) {- toast.error(err.message || t('app.proxyStackPanel.failedToRegenerateConfig', 'Failed to regenerate config'));+ toastError(toast, t('app.proxyStackPanel.failedToRegenerateConfig', 'Failed to regenerate config'), err);} finally {setBusy(false);}@@ -153,14 +154,14 @@ const ProxyStackPanel = ({ serverId }) => {});const deploy = res.deploy;if (deploy && deploy.success === false) {- toast.error(deploy.error || t('app.proxyStackPanel.deployFailedBestEffort', 'Deploy failed (best-effort)'));+ toastError(toast, t('app.proxyStackPanel.deployFailedBestEffort', 'Deploy failed (best-effort)'), deploy.error);} else {toast.success(t('app.proxyStackPanel.stackDeployed', 'Stack deployed'));}await load();await loadAudit();} catch (err) {- toast.error(err.message || t('app.proxyStackPanel.failedToDeployStack', 'Failed to deploy stack'));+ toastError(toast, t('app.proxyStackPanel.failedToDeployStack', 'Failed to deploy stack'), err);} finally {setBusy(false);}diff --git a/frontend/src/components/security/FirewallTab.jsx b/frontend/src/components/security/FirewallTab.jsxindex eb88960d..320a1c07 100644--- a/frontend/src/components/security/FirewallTab.jsx+++ b/frontend/src/components/security/FirewallTab.jsx@@ -22,6 +22,7 @@ import { Ban, Shield } from 'lucide-react';import { Select, SelectTrigger, SelectContent, SelectItem, SelectValue } from '@/components/ui/select';import { useTranslation } from 'react-i18next';import { Card as SharedCard, CardHeader as SharedCardHeader, CardContent as SharedCardContent } from '@/components/ui/card';+import { errorReason } from '@/utils/errorMessage';const RULE_TYPE_TONES = {port: 'accent',@@ -201,7 +202,7 @@ const FirewallTab = () => {setGuard(data);toast.success(t('app.firewallTab.cloudMetadataGuard', 'Cloud metadata guard {{value}}', { value: enabled ? 'enabled' : 'disabled' }));} catch (error) {- toast.error(t('app.firewallTab.failedToUpdateMetadataGuard', 'Failed to update metadata guard: {{message}}', { message: error.message }));+ toast.error(t('app.firewallTab.failedToUpdateMetadataGuard', 'Failed to update metadata guard: {{message}}', { message: errorReason(error) }));await loadGuard();} finally {setGuardLoading(false);@@ -215,7 +216,7 @@ const FirewallTab = () => {toast.success(t('app.firewallTab.firewallEnabled', 'Firewall enabled'));await loadStatus();} catch (error) {- toast.error(t('app.firewallTab.failedToEnableFirewall', 'Failed to enable firewall: {{message}}', { message: error.message }));+ toast.error(t('app.firewallTab.failedToEnableFirewall', 'Failed to enable firewall: {{message}}', { message: errorReason(error) }));} finally {setActionLoading(false);}@@ -235,7 +236,7 @@ const FirewallTab = () => {toast.success(t('app.firewallTab.firewallDisabled', 'Firewall disabled'));await loadStatus();} catch (error) {- toast.error(t('app.firewallTab.failedToDisableFirewall', 'Failed to disable firewall: {{message}}', { message: error.message }));+ toast.error(t('app.firewallTab.failedToDisableFirewall', 'Failed to disable firewall: {{message}}', { message: errorReason(error) }));} finally {setActionLoading(false);}@@ -252,7 +253,7 @@ const FirewallTab = () => {await loadBlockedIPs();await loadRules();} catch (error) {- toast.error(t('app.firewallTab.failedToBlockIp', 'Failed to block IP: {{message}}', { message: error.message }));+ toast.error(t('app.firewallTab.failedToBlockIp', 'Failed to block IP: {{message}}', { message: errorReason(error) }));} finally {setActionLoading(false);}@@ -272,7 +273,7 @@ const FirewallTab = () => {await loadBlockedIPs();await loadRules();} catch (error) {- toast.error(t('app.firewallTab.failedToUnblockIp', 'Failed to unblock IP: {{message}}', { message: error.message }));+ toast.error(t('app.firewallTab.failedToUnblockIp', 'Failed to unblock IP: {{message}}', { message: errorReason(error) }));}};@@ -286,7 +287,7 @@ const FirewallTab = () => {setNewPort({ port: '', protocol: 'tcp' });await loadRules();} catch (error) {- toast.error(t('app.firewallTab.failedToAllowPort', 'Failed to allow port: {{message}}', { message: error.message }));+ toast.error(t('app.firewallTab.failedToAllowPort', 'Failed to allow port: {{message}}', { message: errorReason(error) }));} finally {setActionLoading(false);}@@ -299,7 +300,7 @@ const FirewallTab = () => {toast.success(t('app.firewallTab.portAllowed', 'Port {{port}}/{{protocol}} allowed', { port: port, protocol: protocol }));await loadRules();} catch (error) {- toast.error(t('app.firewallTab.failedToAllowPort', 'Failed to allow port: {{message}}', { message: error.message }));+ toast.error(t('app.firewallTab.failedToAllowPort', 'Failed to allow port: {{message}}', { message: errorReason(error) }));} finally {setActionLoading(false);}@@ -318,7 +319,7 @@ const FirewallTab = () => {toast.success(t('app.firewallTab.portRuleRemoved', 'Port {{port}}/{{protocol}} rule deleted', { port: port, protocol: protocol }));await loadRules();} catch (error) {- toast.error(t('app.firewallTab.failedToRemovePort', 'Failed to delete port rule: {{message}}', { message: error.message }));+ toast.error(t('app.firewallTab.failedToRemovePort', 'Failed to delete port rule: {{message}}', { message: errorReason(error) }));}};@@ -330,7 +331,7 @@ const FirewallTab = () => {setShowInstallModal(false);await loadData();} catch (error) {- toast.error(t('app.firewallTab.failedToInstallFirewall', 'Failed to install firewall: {{message}}', { message: error.message }));+ toast.error(t('app.firewallTab.failedToInstallFirewall', 'Failed to install firewall: {{message}}', { message: errorReason(error) }));} finally {setActionLoading(false);}diff --git a/frontend/src/components/security/IPListsTab.jsx b/frontend/src/components/security/IPListsTab.jsxindex a073a45c..b518b261 100644--- a/frontend/src/components/security/IPListsTab.jsx+++ b/frontend/src/components/security/IPListsTab.jsx@@ -17,6 +17,7 @@ import { useColumnVisibility } from '@/hooks/useColumnVisibility';import { useTranslation } from 'react-i18next';import { t } from '../../i18n/t';import { Card as SharedCard, CardHeader as SharedCardHeader, CardContent as SharedCardContent } from '@/components/ui/card';+import { errorReason } from '@/utils/errorMessage';// Both lists have the same columns; only the accent tone and the remove// target differ, so one factory builds both. Two accessors per column on@@ -179,7 +180,7 @@ const IPListsTab = () => {setNewComment('');await loadLists();} catch (error) {- toast.error(t('app.iPListsTab.failedToAddIp', 'Failed to add IP: {{message}}', { message: error.message }));+ toast.error(t('app.iPListsTab.failedToAddIp', 'Failed to add IP: {{message}}', { message: errorReason(error) }));} finally {setActionLoading(false);}@@ -205,14 +206,14 @@ const IPListsTab = () => {toast.success(t('app.iPListsTab.ipRestoredTo', 'IP restored to {{listType}}', { listType: listType }));await loadLists();} catch (error) {- toast.error(t('app.iPListsTab.couldNotRestoreIp', 'Could not restore IP: {{message}}', { message: error.message }));+ toast.error(t('app.iPListsTab.couldNotRestoreIp', 'Could not restore IP: {{message}}', { message: errorReason(error) }));}},},});await loadLists();} catch (error) {- toast.error(t('app.iPListsTab.failedToRemoveIp', 'Failed to remove IP: {{message}}', { message: error.message }));+ toast.error(t('app.iPListsTab.failedToRemoveIp', 'Failed to remove IP: {{message}}', { message: errorReason(error) }));}};diff --git a/frontend/src/components/security/SSHKeysTab.jsx b/frontend/src/components/security/SSHKeysTab.jsxindex 554f9d5f..2c80ed62 100644--- a/frontend/src/components/security/SSHKeysTab.jsx+++ b/frontend/src/components/security/SSHKeysTab.jsx@@ -18,6 +18,7 @@ import { useTableSort } from '@/hooks/useTableSort';import { useColumnVisibility } from '@/hooks/useColumnVisibility';import { useTranslation } from 'react-i18next';import { Card as SharedCard } from '@/components/ui/card';+import { errorReason } from '@/utils/errorMessage';// What the Comment cell renders when a key carries none. It has to be a real// value, not '': `ruleIsArmed` drops any rule whose value is empty, so@@ -104,7 +105,7 @@ const SSHKeysTab = () => {setNewKey('');await loadKeys();} catch (error) {- toast.error(t('app.sSHKeysTab.failedToAddKey', 'Failed to add key: {{message}}', { message: error.message }));+ toast.error(t('app.sSHKeysTab.failedToAddKey', 'Failed to add key: {{message}}', { message: errorReason(error) }));} finally {setActionLoading(false);}@@ -123,7 +124,7 @@ const SSHKeysTab = () => {toast.success(t('app.sSHKeysTab.sshKeyRemoved', 'SSH key deleted'));await loadKeys();} catch (error) {- toast.error(t('app.sSHKeysTab.failedToRemoveKey', 'Failed to delete key: {{message}}', { message: error.message }));+ toast.error(t('app.sSHKeysTab.failedToRemoveKey', 'Failed to delete key: {{message}}', { message: errorReason(error) }));}};diff --git a/frontend/src/components/server/OnboardingWizard.jsx b/frontend/src/components/server/OnboardingWizard.jsxindex e5149d87..9fdb7755 100644--- a/frontend/src/components/server/OnboardingWizard.jsx+++ b/frontend/src/components/server/OnboardingWizard.jsx@@ -6,6 +6,7 @@ import { Pill } from '../ds';import { CheckCircle2, Loader2, Circle, XCircle, RotateCw, Clock, ChevronDown } from 'lucide-react';import { usePolling } from '@/hooks/usePolling';import { useTranslation } from 'react-i18next';+import { toastError } from '@/utils/errorMessage';// Onboarding status cadence while non-terminal.const ONBOARDING_POLL_MS = 3000;@@ -137,7 +138,7 @@ const OnboardingWizard = ({ serverId, initialState, onStateChange }) => {toast.success(t('app.onboardingWizard.retryingOnboarding', 'Retrying onboarding'));loadStatus();} catch (err) {- toast.error(err.message || t('app.onboardingWizard.failedToRetryOnboarding', 'Failed to retry onboarding'));+ toastError(toast, t('app.onboardingWizard.failedToRetryOnboarding', 'Failed to retry onboarding'), err);} finally {setRetrying(false);}diff --git a/frontend/src/components/serverdetail/CloudflaredTab.jsx b/frontend/src/components/serverdetail/CloudflaredTab.jsxindex a21bae76..2f502198 100644--- a/frontend/src/components/serverdetail/CloudflaredTab.jsx+++ b/frontend/src/components/serverdetail/CloudflaredTab.jsx@@ -23,6 +23,7 @@ import {OfflineIcon,TrashIcon,} from './serverDetailShared';+import { toastError } from '@/utils/errorMessage';// CloudflaredTab — manage Cloudflare named tunnels via the agent.//@@ -167,7 +168,7 @@ const CloudflaredTab = ({ serverId, serverStatus }) => {setCreateName('');loadTunnels();} catch (err) {- toast.error(err.message || t('app.cloudflaredTab.failedToCreateTunnel', 'Failed to create tunnel'));+ toastError(toast, t('app.cloudflaredTab.failedToCreateTunnel', 'Failed to create tunnel'), err);} finally {setCreating(false);}@@ -185,7 +186,7 @@ const CloudflaredTab = ({ serverId, serverStatus }) => {setRouteHostname('');setRouteTunnel(null);} catch (err) {- toast.error(err.message || t('app.cloudflaredTab.failedToAddRoute', 'Failed to add route'));+ toastError(toast, t('app.cloudflaredTab.failedToAddRoute', 'Failed to add route'), err);} finally {setRouting(false);}@@ -203,7 +204,7 @@ const CloudflaredTab = ({ serverId, serverStatus }) => {toast.success(t('app.cloudflaredTab.tunnelDeleted', 'Tunnel deleted'));loadTunnels();} catch (err) {- toast.error(err.message || t('app.cloudflaredTab.failedToDeleteTunnel', 'Failed to delete tunnel'));+ toastError(toast, t('app.cloudflaredTab.failedToDeleteTunnel', 'Failed to delete tunnel'), err);}}@@ -249,7 +250,7 @@ const CloudflaredTab = ({ serverId, serverStatus }) => {};stopStream = joinServerStream(room, 'server_stream', onStream);} catch (err) {- toast.error(err.message || t('app.cloudflaredTab.failedToStartLogin', 'Failed to start login'));+ toastError(toast, t('app.cloudflaredTab.failedToStartLogin', 'Failed to start login'), err);setLogin(null);}}diff --git a/frontend/src/components/serverdetail/CronTab.jsx b/frontend/src/components/serverdetail/CronTab.jsxindex cadaa055..2d83c0fd 100644--- a/frontend/src/components/serverdetail/CronTab.jsx+++ b/frontend/src/components/serverdetail/CronTab.jsx@@ -31,6 +31,7 @@ import {PlayIcon,TrashIcon,} from './serverDetailShared';+import { toastError } from '@/utils/errorMessage';// Built-in saved views. A remote cron entry is only// { id, schedule, command, enabled, name?, description? } — the agent parses@@ -139,7 +140,7 @@ const CronTab = ({ serverId, serverStatus }) => {toast.success(t('app.cronTab.job', 'Job {{value}}', { value: !job.enabled ? 'enabled' : 'disabled' }));loadJobs();} catch (err) {- toast.error(err.message || t('app.cronTab.failedToToggleJob', 'Failed to toggle job'));+ toastError(toast, t('app.cronTab.failedToToggleJob', 'Failed to toggle job'), err);}}@@ -156,7 +157,7 @@ const CronTab = ({ serverId, serverStatus }) => {toast.success(t('app.cronTab.cronJobRemoved', 'Cron job deleted'));loadJobs();} catch (err) {- toast.error(err.message || t('app.cronTab.failedToRemoveJob', 'Failed to delete job'));+ toastError(toast, t('app.cronTab.failedToRemoveJob', 'Failed to delete job'), err);}}@@ -182,7 +183,7 @@ const CronTab = ({ serverId, serverStatus }) => {setForm({ name: '', schedule: '0 * * * *', command: '' });loadJobs();} catch (err) {- toast.error(err.message || t('app.cronTab.failedToAddCronJob', 'Failed to add cron job'));+ toastError(toast, t('app.cronTab.failedToAddCronJob', 'Failed to add cron job'), err);} finally {setSubmitting(false);}diff --git a/frontend/src/components/serverdetail/PackagesTab.jsx b/frontend/src/components/serverdetail/PackagesTab.jsxindex ab031f70..c3f06e15 100644--- a/frontend/src/components/serverdetail/PackagesTab.jsx+++ b/frontend/src/components/serverdetail/PackagesTab.jsx@@ -8,6 +8,7 @@ import { Badge } from '@/components/ui/badge';import { ListToolbar } from '../ds';import JobProgressModal from '../JobProgressModal';import { useTranslation } from 'react-i18next';+import { toastError } from '@/utils/errorMessage';// Quick-install presets — packages most users want first when setting// up a new server. The agent's manager-detect handles distro mapping;@@ -46,7 +47,7 @@ const PackagesTab = ({ serverId, serverStatus }) => {setInstalledRaw(data?.output || '');setManager(data?.manager || '');} catch (err) {- toast.error(err.message || t('app.serverPackagesTab.failedToLoadPackages', 'Failed to load packages'));+ toastError(toast, t('app.serverPackagesTab.failedToLoadPackages', 'Failed to load packages'), err);} finally {setLoadingInstalled(false);}@@ -72,7 +73,7 @@ const PackagesTab = ({ serverId, serverStatus }) => {const data = await api.searchRemotePackages(serverId, q, 100);setSearchResults(data?.results || []);} catch (err) {- toast.error(err.message || t('app.serverPackagesTab.searchFailed', 'Search failed'));+ toastError(toast, t('app.serverPackagesTab.searchFailed', 'Search failed'), err);setSearchResults([]);} finally {setSearching(false);@@ -85,7 +86,7 @@ const PackagesTab = ({ serverId, serverStatus }) => {const channel = result?.channel || `job:${result?.job_id}`;setJob({ channel, title: `Installing ${name}` });} catch (err) {- toast.error(err.message || t('app.serverPackagesTab.failedToStartInstall', 'Failed to start install', { }));+ toastError(toast, t('app.serverPackagesTab.failedToStartInstall', 'Failed to start install', { }), err);}}@@ -101,7 +102,7 @@ const PackagesTab = ({ serverId, serverStatus }) => {await api.removeRemotePackage(serverId, name);toast.success(`${name} removed`);} catch (err) {- toast.error(err.message || t('app.serverPackagesTab.removeFailed', 'Uninstall failed'));+ toastError(toast, t('app.serverPackagesTab.removeFailed', 'Uninstall failed'), err);}}@@ -110,7 +111,7 @@ const PackagesTab = ({ serverId, serverStatus }) => {await api.updateRemotePackageCache(serverId);toast.success(t('app.serverPackagesTab.packageCacheUpdated', 'Package cache updated ({{value}})', { value: manager || 'manager' }));} catch (err) {- toast.error(err.message || t('app.serverPackagesTab.updateFailed', 'Update failed'));+ toastError(toast, t('app.serverPackagesTab.updateFailed', 'Update failed'), err);}}@@ -125,7 +126,7 @@ const PackagesTab = ({ serverId, serverStatus }) => {const channel = result?.channel || `job:${result?.job_id}`;setJob({ channel, titleKey: 'app.serverPackagesTab.upgradingAllPackages', title: 'Upgrading all packages' });} catch (err) {- toast.error(err.message || t('app.serverPackagesTab.upgradeFailedToStart', 'Upgrade failed to start'));+ toastError(toast, t('app.serverPackagesTab.upgradeFailedToStart', 'Upgrade failed to start'), err);}}diff --git a/frontend/src/components/serverdetail/ServerDockerTab.jsx b/frontend/src/components/serverdetail/ServerDockerTab.jsxindex f558a971..0dd1419f 100644--- a/frontend/src/components/serverdetail/ServerDockerTab.jsx+++ b/frontend/src/components/serverdetail/ServerDockerTab.jsx@@ -14,6 +14,7 @@ import {PlayIcon,TrashIcon,} from './serverDetailShared';+import { toastError } from '@/utils/errorMessage';// The /servers/<id>/docker/* endpoints return raw arrays from Flask// (route extracts result.get('data') before jsonify). The agent envelope's@@ -174,7 +175,7 @@ const ServerDockerTab = ({ serverId, serverStatus, server }) => {}loadDockerData();} catch (err) {- toast.error(err.message || t('app.serverDockerTab.failedToContainer', 'Failed to {{action}} container', { action: action }));+ toastError(toast, t('app.serverDockerTab.failedToContainer', 'Failed to {{action}} container', { action: action }), err);}}diff --git a/frontend/src/components/serverdetail/ServerRestorePointsTab.jsx b/frontend/src/components/serverdetail/ServerRestorePointsTab.jsxindex 9ec793f3..ee23d706 100644--- a/frontend/src/components/serverdetail/ServerRestorePointsTab.jsx+++ b/frontend/src/components/serverdetail/ServerRestorePointsTab.jsx@@ -8,6 +8,7 @@ import { Button } from '../ui/button';import { Select, SelectTrigger, SelectContent, SelectItem, SelectValue } from '../ui/select';import { useToast } from '../../contexts/useToast.js';import { useTranslation } from 'react-i18next';+import { toastError } from '@/utils/errorMessage';export default function ServerRestorePointsTab({ serverId }) {const { t } = useTranslation();@@ -76,7 +77,7 @@ export default function ServerRestorePointsTab({ serverId }) {toast.success(t('app.serverRestorePoints.quicksaveCreated', 'Environment restore point saved'));} catch (err) {setSaveError(err.message);- toast.error(err.message || t('app.serverRestorePoints.quicksaveFailed', 'Failed to save restore point'));+ toastError(toast, t('app.serverRestorePoints.quicksaveFailed', 'Failed to save restore point'), err);} finally {setSaving(false);}diff --git a/frontend/src/components/serverdetail/ServerSettingsTab.jsx b/frontend/src/components/serverdetail/ServerSettingsTab.jsxindex 2cd81ca7..26e4b774 100644--- a/frontend/src/components/serverdetail/ServerSettingsTab.jsx+++ b/frontend/src/components/serverdetail/ServerSettingsTab.jsx@@ -28,6 +28,7 @@ import {TrashIcon,TagIcon,} from './serverDetailShared';+import { toastError } from '@/utils/errorMessage';// Radix Select items cannot carry an empty value; this stands for "no group".const NO_GROUP = '__none';@@ -113,7 +114,7 @@ const ServerSettingsTab = ({ server, onUpdate, onRegenerateToken, onDelete }) =>setNewIP('');toast.success(t('app.serverSettingsTab.ipAllowlistUpdated', 'IP allowlist updated'));} catch (err) {- toast.error(err.details?.[0] || err.message || t('app.serverSettingsTab.invalidIpPattern', 'Invalid IP pattern'));+ toastError(toast, t('app.serverSettingsTab.invalidIpPattern', 'Invalid IP pattern'), err.details?.[0] || err);}}@@ -124,7 +125,7 @@ const ServerSettingsTab = ({ server, onUpdate, onRegenerateToken, onDelete }) =>setAllowedIPs(updated);toast.success(t('app.serverSettingsTab.ipRemovedFromAllowlist', 'IP removed from allowlist'));} catch (err) {- toast.error(err.message || t('app.serverSettingsTab.failedToUpdateAllowlist', 'Failed to update allowlist'));+ toastError(toast, t('app.serverSettingsTab.failedToUpdateAllowlist', 'Failed to update allowlist'), err);}}@@ -137,10 +138,10 @@ const ServerSettingsTab = ({ server, onUpdate, onRegenerateToken, onDelete }) =>if (result.success) {toast.success(t('app.serverSettingsTab.credentialRotationInitiatedAgentWillUpdate', 'Credential rotation initiated. Agent will update shortly.'));} else {- toast.error(result.error || t('app.serverSettingsTab.failedToRotateCredentials', 'Failed to rotate credentials'));+ toastError(toast, t('app.serverSettingsTab.failedToRotateCredentials', 'Failed to rotate credentials'), result.error);}} catch (err) {- toast.error(err.message || t('app.serverSettingsTab.failedToRotateCredentials', 'Failed to rotate credentials'));+ toastError(toast, t('app.serverSettingsTab.failedToRotateCredentials', 'Failed to rotate credentials'), err);} finally {setRotatingKey(false);}@@ -155,7 +156,7 @@ const ServerSettingsTab = ({ server, onUpdate, onRegenerateToken, onDelete }) =>toast.success(t('app.serverSettingsTab.serverUpdatedSuccessfully', 'Server updated'));onUpdate();} catch (err) {- toast.error(err.message || t('app.serverSettingsTab.failedToUpdateServer', 'Failed to update server'));+ toastError(toast, t('app.serverSettingsTab.failedToUpdateServer', 'Failed to update server'), err);} finally {setLoading(false);}@@ -401,7 +402,7 @@ export const TokenModal = ({ server, onClose, onGenerated }) => {onGenerated?.(data);toast.success(t('app.serverSettingsTab.connectionStringGenerated', 'Connection string generated'));} catch (err) {- toast.error(err.message || t('app.serverSettingsTab.failedToGenerateConnectionString', 'Failed to generate connection string'));+ toastError(toast, t('app.serverSettingsTab.failedToGenerateConnectionString', 'Failed to generate connection string'), err);} finally {setGenerating(false);}diff --git a/frontend/src/components/serverdetail/ServicesTab.jsx b/frontend/src/components/serverdetail/ServicesTab.jsxindex c870c8c4..707d153d 100644--- a/frontend/src/components/serverdetail/ServicesTab.jsx+++ b/frontend/src/components/serverdetail/ServicesTab.jsx@@ -15,6 +15,7 @@ import LogContent from '../log-viewer/LogContent';import { downloadBlob } from '@/utils/downloadBlob';import { usePolling } from '@/hooks/usePolling';import { useTranslation } from 'react-i18next';+import { toastError } from '@/utils/errorMessage';// Unit log tail cadence while auto-refresh is on.const LOG_TAIL_MS = 3000;@@ -150,7 +151,7 @@ const ServicesTab = ({ serverId = null, serverStatus = 'online' }) => {setUnits(data?.units || []);}} catch (err) {- toast.error(err.message || t('app.servicesTab.failedToLoadServices', 'Failed to load services'));+ toastError(toast, t('app.servicesTab.failedToLoadServices', 'Failed to load services'), err);} finally {setLoading(false);}@@ -211,7 +212,7 @@ const ServicesTab = ({ serverId = null, serverStatus = 'online' }) => {// re-fetching the list is simpler and keeps the filter consistent.loadUnits();} catch (err) {- toast.error(err.message || t('app.servicesTab.failedTo', 'Failed to {{action}} {{unit}}', { action: action, unit: unit }));+ toastError(toast, t('app.servicesTab.failedTo', 'Failed to {{action}} {{unit}}', { action: action, unit: unit }), err);} finally {setBusyUnit(null);}@@ -266,7 +267,7 @@ const ServicesTab = ({ serverId = null, serverStatus = 'online' }) => {await api.reloadRemoteSystemdDaemon(serverId);toast.success(t('app.servicesTab.systemctlDaemonReloadCompleted', 'systemctl daemon-reload completed'));} catch (err) {- toast.error(err.message || t('app.servicesTab.daemonReloadFailed', 'daemon-reload failed'));+ toastError(toast, t('app.servicesTab.daemonReloadFailed', 'daemon-reload failed'), err);} finally {setBusyUnit(null);}diff --git a/frontend/src/components/serverdetail/SurveyTab.jsx b/frontend/src/components/serverdetail/SurveyTab.jsxindex ad5f72c7..2f87f92b 100644--- a/frontend/src/components/serverdetail/SurveyTab.jsx+++ b/frontend/src/components/serverdetail/SurveyTab.jsx@@ -18,6 +18,7 @@ import {Radio,Network,} from 'lucide-react';+import { toastError } from '@/utils/errorMessage';// Survey tab (plan 27/28) — the read-only "Server Map" for a paired agent.//@@ -98,7 +99,7 @@ const SurveyTab = ({ serverId, serverStatus, server }) => {toast.success(t('app.surveyTab.surveyComplete', 'Survey complete'));await load();} catch (err) {- toast.error(err.message || t('app.surveyTab.surveyFailed', 'Survey failed'));+ toastError(toast, t('app.surveyTab.surveyFailed', 'Survey failed'), err);} finally {setFlying(false);}@@ -114,7 +115,7 @@ const SurveyTab = ({ serverId, serverStatus, server }) => {setCatalog(data);setShowCatalog(true);} catch (err) {- toast.error(err.message || t('app.surveyTab.failedToLoadProbeIndex', 'Failed to load probe index'));+ toastError(toast, t('app.surveyTab.failedToLoadProbeIndex', 'Failed to load probe index'), err);}}@@ -127,7 +128,7 @@ const SurveyTab = ({ serverId, serverStatus, server }) => {const obs = await api.getServerObservedStatus(serverId).catch(() => null);if (obs) setObserved(obs);} catch (err) {- toast.error(err.message || t('app.surveyTab.failedToSwitchMode', 'Failed to switch mode'));+ toastError(toast, t('app.surveyTab.failedToSwitchMode', 'Failed to switch mode'), err);} finally {setSwitching(false);}@@ -140,7 +141,7 @@ const SurveyTab = ({ serverId, serverStatus, server }) => {const obs = await api.getServerObservedStatus(serverId).catch(() => null);if (obs) setObserved(obs);} catch (err) {- toast.error(err.message || t('app.surveyTab.failedToUpdateSetting', 'Failed to update setting'));+ toastError(toast, t('app.surveyTab.failedToUpdateSetting', 'Failed to update setting'), err);} finally {setSwitching(false);}diff --git a/frontend/src/components/serverdetail/SystemStatusCard.jsx b/frontend/src/components/serverdetail/SystemStatusCard.jsxindex 4ac47e8f..addd375d 100644--- a/frontend/src/components/serverdetail/SystemStatusCard.jsx+++ b/frontend/src/components/serverdetail/SystemStatusCard.jsx@@ -4,6 +4,7 @@ import { useToast } from '../../contexts/useToast.js';import { Button } from '@/components/ui/button';import { Badge } from '@/components/ui/badge';import { useTranslation } from 'react-i18next';+import { toastError } from '@/utils/errorMessage';// Surfaces everything the agent's capability probe reports: detected// runtimes (python/node/php/go/ruby/java versions), runtime version@@ -36,7 +37,7 @@ export default function SystemStatusCard({ server, onRefresh }) {toast.success(t('app.systemStatusCard.capabilitiesReProbed', 'Capabilities re-probed'));if (onRefresh) await onRefresh();} catch (err) {- toast.error(err.message || t('app.systemStatusCard.refreshFailed', 'Refresh failed'));+ toastError(toast, t('app.systemStatusCard.refreshFailed', 'Refresh failed'), err);} finally {setRefreshing(false);}diff --git a/frontend/src/components/servers/LinkPanelForm.jsx b/frontend/src/components/servers/LinkPanelForm.jsxindex 55285f89..ca0352b1 100644--- a/frontend/src/components/servers/LinkPanelForm.jsx+++ b/frontend/src/components/servers/LinkPanelForm.jsx@@ -9,6 +9,7 @@ import { Button } from '@/components/ui/button';import { Input } from '@/components/ui/input';import { usePolling } from '@/hooks/usePolling';import { useTranslation } from 'react-i18next';+import { toastError } from '@/utils/errorMessage';const POLL_INTERVAL = 5000;@@ -73,7 +74,7 @@ const LinkPanelForm = ({ onClose }) => {setUnlinkOpen(false);setStatus({ linked: false });} catch (err) {- toast.error(err?.data?.error || err.message || t('app.linkPanelForm.failedToUnlinkPanel', 'Failed to unlink panel'));+ toastError(toast, t('app.linkPanelForm.failedToUnlinkPanel', 'Failed to unlink panel'), err);}}diff --git a/frontend/src/components/service-detail/AttachmentsCard.jsx b/frontend/src/components/service-detail/AttachmentsCard.jsxindex 20f8da15..96b010c9 100644--- a/frontend/src/components/service-detail/AttachmentsCard.jsx+++ b/frontend/src/components/service-detail/AttachmentsCard.jsx@@ -11,6 +11,7 @@ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@import { useToast } from '../../contexts/useToast.js';import { useAuth } from '../../contexts/useAuth.js';import { useConfirm } from '@/hooks/useConfirm';+import { toastError } from '@/utils/errorMessage';// Kind -> the template installed when none exists yet. Must match what the// backend accepts for that kind (app_attachment_service.CONNECTION_KINDS).@@ -83,7 +84,7 @@ export default function AttachmentsCard({ app }) {setChoices(data);if (data.services?.length) setSelected(String(data.services[0].id));} catch (err) {- toast.error(err.message);+ toastError(toast, t('app.attachments.couldntLoadAttachable', "Couldn't load the services you can attach."), err);setKind(null);}}@@ -97,7 +98,7 @@ export default function AttachmentsCard({ app }) {setKind(null);load();} catch (err) {- toast.error(err.message);+ toastError(toast, t('app.attachments.couldntAttach', "Couldn't attach the service."), err);} finally {setBusy(false);}@@ -116,7 +117,7 @@ export default function AttachmentsCard({ app }) {if (!serviceId) throw new Error(t('app.attachments.installNoId', 'Installed, but the new service could not be found. Attach it from the list.'));await attach(serviceId);} catch (err) {- toast.error(err.message);+ toastError(toast, t('app.attachments.couldntInstallAndAttach', "Couldn't install and attach the service."), err);setBusy(false);}}@@ -135,7 +136,7 @@ export default function AttachmentsCard({ app }) {setNeedsRedeploy(true);load();} catch (err) {- toast.error(err.message);+ toastError(toast, t('app.attachments.couldntDetach', "Couldn't detach the service."), err);}}@@ -146,7 +147,7 @@ export default function AttachmentsCard({ app }) {toast.success(t('app.attachments.redeploying', 'Redeploy started'));setNeedsRedeploy(false);} catch (err) {- toast.error(err.message);+ toastError(toast, t('app.attachments.couldntRedeploy', "Couldn't redeploy the service."), err);} finally {setBusy(false);}diff --git a/frontend/src/components/service-detail/GunicornTab.jsx b/frontend/src/components/service-detail/GunicornTab.jsxindex 294b5d09..47b8e1e4 100644--- a/frontend/src/components/service-detail/GunicornTab.jsx+++ b/frontend/src/components/service-detail/GunicornTab.jsx@@ -5,6 +5,7 @@ import { Button } from '@/components/ui/button';import { Textarea } from '@/components/ui/textarea';import EmptyState from '../EmptyState';import { useTranslation } from 'react-i18next';+import { toastError } from '@/utils/errorMessage';const GunicornTab = ({ appId }) => {const { t } = useTranslation();@@ -33,8 +34,8 @@ const GunicornTab = ({ appId }) => {try {await api.updateGunicornConfig(appId, config);toast.success(t('app.gunicornTab.configurationSavedRestartTheAppTo', 'Configuration saved. Restart the service to apply changes.'));- } catch {- toast.error(t('app.gunicornTab.failedToSaveConfiguration', 'Failed to save configuration'));+ } catch (err) {+ toastError(toast, t('app.gunicornTab.failedToSaveConfiguration', 'Failed to save configuration'), err);} finally {setSaving(false);}diff --git a/frontend/src/components/service-detail/PackagesTab.jsx b/frontend/src/components/service-detail/PackagesTab.jsxindex d5c2147e..0862a06e 100644--- a/frontend/src/components/service-detail/PackagesTab.jsx+++ b/frontend/src/components/service-detail/PackagesTab.jsx@@ -6,6 +6,7 @@ import { Input } from '@/components/ui/input';import EmptyState from '../EmptyState';import { DataTable, DataTableFooter } from '@/components/ds';import { useTranslation } from 'react-i18next';+import { toastError } from '@/utils/errorMessage';// DataTable columns. Cell markup and classNames are identical to the// hand-rolled table they replace, so _service-detail.scss keeps applying@@ -73,8 +74,8 @@ const PackagesTab = ({ appId }) => {try {await api.freezePythonRequirements(appId);toast.success(t('app.packagesTab.requirementsTxtUpdated', 'requirements.txt updated'));- } catch {- toast.error(t('app.packagesTab.failedToFreezeRequirements', 'Failed to freeze requirements'));+ } catch (err) {+ toastError(toast, t('app.packagesTab.failedToFreezeRequirements', 'Failed to freeze requirements'), err);}}diff --git a/frontend/src/components/service-detail/PoolerCard.jsx b/frontend/src/components/service-detail/PoolerCard.jsxindex 9de44e49..258b5056 100644--- a/frontend/src/components/service-detail/PoolerCard.jsx+++ b/frontend/src/components/service-detail/PoolerCard.jsx@@ -3,6 +3,7 @@ import { useTranslation } from 'react-i18next';import api from '../../services/api';import { Switch } from '@/components/ui/switch';import { useToast } from '../../contexts/useToast.js';+import { toastError } from '@/utils/errorMessage';// Opt-in PgBouncer beside an installed PostgreSQL (plan 86 §D1). Renders only// for PostgreSQL installs. Apps keep the direct connection unless they switch@@ -37,7 +38,7 @@ export default function PoolerCard({ app }) {: t('app.pooler.off', 'Pooler removed'));}} catch (err) {- toast.error(err.message);+ toastError(toast, t('app.pooler.couldntChangePooler', "Couldn't change the connection pooler."), err);} finally {setSaving(false);}diff --git a/frontend/src/components/service-detail/SettingsTab.jsx b/frontend/src/components/service-detail/SettingsTab.jsxindex fd3f3be5..a1651418 100644--- a/frontend/src/components/service-detail/SettingsTab.jsx+++ b/frontend/src/components/service-detail/SettingsTab.jsx@@ -44,6 +44,7 @@ import { Select, SelectTrigger, SelectContent, SelectItem, SelectValue } from '@import { downloadBlob } from '@/utils/downloadBlob';import { useTranslation } from 'react-i18next';import { Card as SharedCard } from '@/components/ui/card';+import { toastError } from '@/utils/errorMessage';// Grouped left sub-nav for the service Settings tab — mirrors the WordPress// detail page's settings layout: a group label per section with@@ -131,8 +132,8 @@ const SettingsTab = ({ app, deployConfig, domains, primaryDomain, onUpdate }) =>await api.updateAppEnvironment(app.id, newType);setEnvironmentType(newType);onUpdate();- } catch {- toast.error(t('app.settingsTab.failedToUpdateEnvironmentType', 'Failed to update environment type'));+ } catch (err) {+ toastError(toast, t('app.settingsTab.failedToUpdateEnvironmentType', 'Failed to update environment type'), err);setEnvironmentType(app.environment_type || 'standalone');} finally {setSavingEnvironment(false);@@ -151,8 +152,8 @@ const SettingsTab = ({ app, deployConfig, domains, primaryDomain, onUpdate }) =>try {await api.unlinkApp(app.id);onUpdate();- } catch {- toast.error(t('app.settingsTab.failedToUnlinkApp', 'Failed to unlink service'));+ } catch (err) {+ toastError(toast, t('app.settingsTab.failedToUnlinkApp', 'Failed to unlink service'), err);} finally {setUnlinking(false);}@@ -177,8 +178,8 @@ const SettingsTab = ({ app, deployConfig, domains, primaryDomain, onUpdate }) =>await api.deleteApp(app.id);toast.success(t('app.settingsTab.movedToTheRecycleBin', '"{{name}}" moved to the recycle bin', { name: app.name }));navigate('/services');- } catch {- toast.error(t('app.settingsTab.failedToDeleteService', 'Failed to delete service'));+ } catch (err) {+ toastError(toast, t('app.settingsTab.failedToDeleteService', 'Failed to delete service'), err);setDeleting(false);}}@@ -535,7 +536,7 @@ const DomainSslPanel = ({ app, domains, primaryDomain, onUpdate }) => {setAddOpen(false);onUpdate();} catch (err) {- toast.error(err.message || t('app.settingsTab.failedToAttachDomain', 'Failed to attach domain'));+ toastError(toast, t('app.settingsTab.failedToAttachDomain', 'Failed to attach domain'), err);} finally {setAttaching(false);}@@ -567,10 +568,10 @@ const DomainSslPanel = ({ app, domains, primaryDomain, onUpdate }) => {}));onUpdate();} else {- toast.error(res.error || t('app.settingsTab.certificateRequestFailed', 'Certificate request failed'));+ toastError(toast, t('app.settingsTab.certificateRequestFailed', 'Certificate request failed'), res.error);}} catch (err) {- toast.error(err.message || t('app.settingsTab.certificateRequestFailed', 'Certificate request failed'));+ toastError(toast, t('app.settingsTab.certificateRequestFailed', 'Certificate request failed'), err);} finally {setIssuing(false);}@@ -750,7 +751,7 @@ const ManifestSection = ({ app }) => {const yaml = res?.yaml || res?.manifest || '';setScaffold(yaml);} catch (err) {- toast.error(err.message || t('app.settingsTab.failedToGenerateScaffold', 'Failed to generate scaffold'));+ toastError(toast, t('app.settingsTab.failedToGenerateScaffold', 'Failed to generate scaffold'), err);} finally {setScaffolding(false);}@@ -769,7 +770,7 @@ const ManifestSection = ({ app }) => {const res = await api.planManifest(projectId, {});setPlan(res?.plan || null);} catch (err) {- toast.error(err.message || t('app.settingsTab.failedToPlanManifest', 'Failed to plan manifest'));+ toastError(toast, t('app.settingsTab.failedToPlanManifest', 'Failed to plan manifest'), err);} finally {setPlanning(false);}@@ -795,7 +796,7 @@ const ManifestSection = ({ app }) => {toast.error(t('app.settingsTab.applyFinishedWithErrors', 'Apply finished with errors'));}} catch (err) {- toast.error(err.message || t('app.settingsTab.failedToApplyManifest', 'Failed to apply manifest'));+ toastError(toast, t('app.settingsTab.failedToApplyManifest', 'Failed to apply manifest'), err);} finally {setApplying(false);}diff --git a/frontend/src/components/service-detail/SlotsCard.jsx b/frontend/src/components/service-detail/SlotsCard.jsxindex d963aefc..34132bea 100644--- a/frontend/src/components/service-detail/SlotsCard.jsx+++ b/frontend/src/components/service-detail/SlotsCard.jsx@@ -7,6 +7,7 @@ import { Pill } from '@/components/ds';import { useToast } from '../../contexts/useToast.js';import { useConfirm } from '@/hooks/useConfirm';import { formatRelativeShort } from '@/utils/intl';+import { toastError } from '@/utils/errorMessage';// A/B slot deploys (plan 87 §F). Shows which slot serves, which one is the// standby and for how long it stays warm, with the instant switch back. When@@ -59,7 +60,7 @@ export default function SlotsCard({ app }) {toast.success(t('app.slots.switchedBack', 'Traffic is back on the previous release.'));load();} catch (err) {- toast.error(err.message || t('app.slots.switchBackFailed', 'Switching back failed'));+ toastError(toast, t('app.slots.switchBackFailed', 'Switching back failed'), err);} finally {setSwitching(false);}@@ -83,7 +84,7 @@ export default function SlotsCard({ app }) {toast.success(t('app.slots.restoredDb', 'Database restored to before v{{version}}', { version: offer.version }));load();} catch (err) {- toast.error(err.message || t('app.slots.restoreDbFailed', 'Restoring the database failed'));+ toastError(toast, t('app.slots.restoreDbFailed', 'Restoring the database failed'), err);} finally {setRestoring(false);}diff --git a/frontend/src/components/settings/AppearanceTab.jsx b/frontend/src/components/settings/AppearanceTab.jsxindex 85417edd..c7d7e75b 100644--- a/frontend/src/components/settings/AppearanceTab.jsx+++ b/frontend/src/components/settings/AppearanceTab.jsx@@ -13,6 +13,7 @@ import ThemeBrowseModal from './ThemeBrowseModal';import ThemeStudioModal from './ThemeStudioModal';import api from '../../services/api';import { useTranslation } from 'react-i18next';+import { toastError } from '@/utils/errorMessage';const ACCENT_PRESETS = [{ labelKey: 'app.appearanceTab.indigo', label: 'Indigo', color: '#6366f1' },@@ -49,7 +50,7 @@ const AppearanceTab = () => {if (imported?.slug) setSkin(imported.slug);toast.success(t('app.appearanceTab.importedTheme', 'Imported theme "{{value}}"', { value: imported?.name || imported?.slug }));} catch (err) {- toast.error(err?.message || t('app.appearanceTab.couldNotImportThatThemeJson', 'Could not import that theme.json'));+ toastError(toast, t('app.appearanceTab.couldNotImportThatThemeJson', 'Could not import that theme.json'), err);}};diff --git a/frontend/src/components/settings/MigrationHistoryTab.jsx b/frontend/src/components/settings/MigrationHistoryTab.jsxindex 1dcdc928..cf612c1b 100644--- a/frontend/src/components/settings/MigrationHistoryTab.jsx+++ b/frontend/src/components/settings/MigrationHistoryTab.jsx@@ -16,6 +16,7 @@ import { useConfirm } from '../../hooks/useConfirm';import useSettingFocus from '../../hooks/useSettingFocus';import { useTranslation } from 'react-i18next';import { Button as SharedButton } from '@/components/ui/button';+import { errorReason } from '@/utils/errorMessage';// Revisions in this project are short descriptive slugs (e.g. 016_resource_grants),// so show them in full rather than truncating mid-word.@@ -204,7 +205,7 @@ const MigrationHistoryTab = () => {const name = b?.path ? b.path.split(/[\\/]/).pop() : null;toast.success(name ? t('app.migrationHistoryTab.databaseBackedUp', 'Database backed up ({{name}})', { name: name }) : t('app.migrationHistoryTab.databaseBackedUp2', 'Database backed up'));} catch (err) {- toast.error(t('app.migrationHistoryTab.backupFailedMigrationsNotApplied', 'Backup failed: {{value}}. Migrations were not applied.', { value: err.message || 'unknown error' }));+ toast.error(t('app.migrationHistoryTab.backupFailedMigrationsNotApplied', 'Backup failed: {{value}}. Migrations were not applied.', { value: errorReason(err) }));return;}}@@ -212,7 +213,7 @@ const MigrationHistoryTab = () => {toast.success(t('app.migrationHistoryTab.migrationsAppliedNowAt', 'Migrations applied (now at {{value}})', { value: short(res?.revision || headRev) }));await load();} catch (err) {- toast.error(t('app.migrationHistoryTab.migrationFailed', 'Migration failed: {{value}}', { value: err.message || 'unknown error' }));+ toast.error(t('app.migrationHistoryTab.migrationFailed', 'Migration failed: {{value}}', { value: errorReason(err) }));} finally {setApplying(false);}diff --git a/frontend/src/components/settings/RecycleBinTab.jsx b/frontend/src/components/settings/RecycleBinTab.jsxindex 47ae09a4..1df5de5c 100644--- a/frontend/src/components/settings/RecycleBinTab.jsx+++ b/frontend/src/components/settings/RecycleBinTab.jsx@@ -15,6 +15,7 @@ import { useTableSort } from '@/hooks/useTableSort';import { useColumnVisibility } from '@/hooks/useColumnVisibility';import ConfirmDialog from '@/components/ConfirmDialog';import { useTranslation } from 'react-i18next';+import { toastError } from '@/utils/errorMessage';// Built-in saved views. Neither one names a `kind`: the registry decides what// lands here, so a preset that spelled out 'domain' would be a list this file@@ -108,7 +109,7 @@ export default function RecycleBinTab() {else toast.success(t('app.recycleBinTab.restored', 'Restored {{noun}} "{{label}}"', { noun: row.noun, label: row.label }));await load();} catch (err) {- toast.error(err.message || t('app.recycleBinTab.restoreFailed', 'Restore failed'));+ toastError(toast, t('app.recycleBinTab.restoreFailed', 'Restore failed'), err);} finally {setBusyId(null);}@@ -121,7 +122,7 @@ export default function RecycleBinTab() {toast.success(t('app.recycleBinTab.permanentlyDeleted', 'Permanently deleted "{{label}}"', { label: row.label }));await load();} catch (err) {- toast.error(err.message || t('app.recycleBinTab.deleteFailed', 'Delete failed'));+ toastError(toast, t('app.recycleBinTab.deleteFailed', 'Delete failed'), err);} finally {setBusyId(null);setPurgeTarget(null);diff --git a/frontend/src/components/settings/StorageTab.jsx b/frontend/src/components/settings/StorageTab.jsxindex c4c6d285..4ac577dd 100644--- a/frontend/src/components/settings/StorageTab.jsx+++ b/frontend/src/components/settings/StorageTab.jsx@@ -11,6 +11,7 @@ import EmptyState from '@/components/EmptyState';import DiskReclaimModal from '@/components/monitoring/DiskReclaimModal';import formatBytes from '@/utils/formatBytes';import { formatDateTime, formatPercent, formatRelative } from '@/utils/intl';+import { toastError } from '@/utils/errorMessage';// The four day-count windows plus the rollback window: integers, 0 = off.const NUMBER_KEYS = [@@ -134,7 +135,7 @@ export default function StorageTab() {toast.success(t('app.storageTab.retentionSaved', 'Retention settings saved'));await load();} catch (err) {- toast.error(err.message || t('app.storageTab.saveFailed', 'Could not save retention settings'));+ toastError(toast, t('app.storageTab.saveFailed', 'Could not save retention settings'), err);} finally {setSaving(false);}diff --git a/frontend/src/components/settings/ThemeBrowseModal.jsx b/frontend/src/components/settings/ThemeBrowseModal.jsxindex 883f16f0..12429b12 100644--- a/frontend/src/components/settings/ThemeBrowseModal.jsx+++ b/frontend/src/components/settings/ThemeBrowseModal.jsx@@ -8,6 +8,7 @@ import { useToast } from '../../contexts/useToast.js';import api from '../../services/api';import { useTranslation } from 'react-i18next';import { Button as SharedButton } from '@/components/ui/button';+import { toastError } from '@/utils/errorMessage';// Browse & install community themes from the registry (plan 60, Phase 3).// Offline-tolerant: if the registry is unreachable the panel falls back to the@@ -28,7 +29,7 @@ const ThemeBrowseModal = ({ open, onOpenChange }) => {setThemes(Array.isArray(data?.themes) ? data.themes : []);setSource(data?.source || null);} catch (e) {- toast.error(e?.message || t('app.themeBrowseModal.couldNotLoadTheThemeRegistry', 'Could not load the theme registry'));+ toastError(toast, t('app.themeBrowseModal.couldNotLoadTheThemeRegistry', 'Could not load the theme registry'), e);setThemes([]);} finally {setLoading(false);@@ -50,7 +51,7 @@ const ThemeBrowseModal = ({ open, onOpenChange }) => {)));toast.success(t('app.themeBrowseModal.themeInstalledFindItInThe', 'Theme installed. Find it in the gallery.'));} catch (e) {- toast.error(e?.message || t('app.themeBrowseModal.couldNotInstallThatTheme', 'Could not install that theme'));+ toastError(toast, t('app.themeBrowseModal.couldNotInstallThatTheme', 'Could not install that theme'), e);} finally {setInstalling(null);}diff --git a/frontend/src/components/settings/ThemeGallery.jsx b/frontend/src/components/settings/ThemeGallery.jsxindex 88fce183..8a886369 100644--- a/frontend/src/components/settings/ThemeGallery.jsx+++ b/frontend/src/components/settings/ThemeGallery.jsx@@ -7,6 +7,7 @@ import { DEFAULT_THEME_SLUG } from '../../data/bundledThemes';import api from '../../services/api';import { useTranslation } from 'react-i18next';import { Button as SharedButton } from '@/components/ui/button';+import { toastError } from '@/utils/errorMessage';// Theme Gallery — cards for every selectable skin (bundled seeds + installed).// Apply is instant (tokens are already local); hovering previews live and@@ -30,7 +31,7 @@ const ThemeGallery = () => {await refreshPanelDefault();toast.success(t('app.themeGallery.panelDefaultThemeUpdated', 'Panel default theme updated'));} catch (e) {- toast.error(e?.message || t('app.themeGallery.couldNotSetTheDefaultTheme', 'Could not set the default theme'));+ toastError(toast, t('app.themeGallery.couldNotSetTheDefaultTheme', 'Could not set the default theme'), e);} finally {setBusy(null);}@@ -43,7 +44,7 @@ const ThemeGallery = () => {await Promise.all([refreshInstalledThemes(), refreshPanelDefault()]);toast.success(t('app.themeGallery.themeRemoved', 'Theme removed'));} catch (e) {- toast.error(e?.message || t('app.themeGallery.couldNotRemoveTheTheme', 'Could not remove the theme'));+ toastError(toast, t('app.themeGallery.couldNotRemoveTheTheme', 'Could not remove the theme'), e);} finally {setBusy(null);}diff --git a/frontend/src/components/settings/ThemeStudioModal.jsx b/frontend/src/components/settings/ThemeStudioModal.jsxindex f92807cb..e6cff5ee 100644--- a/frontend/src/components/settings/ThemeStudioModal.jsx+++ b/frontend/src/components/settings/ThemeStudioModal.jsx@@ -14,6 +14,7 @@ import { DEFAULT_THEME_SLUG, BUNDLED_THEME_MAP } from '../../data/bundledThemes'import api from '../../services/api';import { downloadBlob } from '@/utils/downloadBlob';import { useTranslation } from 'react-i18next';+import { toastError } from '@/utils/errorMessage';const REGISTRY_REPO = 'https://github.com/jhd3197/serverkit-themes';@@ -112,7 +113,7 @@ const ThemeStudioModal = ({ open, onOpenChange }) => {toast.success(t('app.themeStudioModal.savedToThisPanel', 'Saved "{{value}}" to this panel', { value: saved?.name }));onOpenChange(false);} catch (e) {- toast.error(e?.message || t('app.themeStudioModal.couldNotSaveTheTheme', 'Could not save the theme'));+ toastError(toast, t('app.themeStudioModal.couldNotSaveTheTheme', 'Could not save the theme'), e);} finally {setSaving(false);}diff --git a/frontend/src/components/settings/WebhooksTab.jsx b/frontend/src/components/settings/WebhooksTab.jsxindex 45c39877..df4599be 100644--- a/frontend/src/components/settings/WebhooksTab.jsx+++ b/frontend/src/components/settings/WebhooksTab.jsx@@ -16,6 +16,7 @@ import EmptyState from '../EmptyState';import ErrorState from '../ErrorState';import CopyField from '@/components/CopyField';import { useTranslation } from 'react-i18next';+import { errorReason } from '@/utils/errorMessage';const formatDate = (d) => (d ? new Date(d).toLocaleString() : '—');@@ -75,7 +76,7 @@ export default function WebhooksTab() {loadAll();toast.success(t('app.webhooksTab.endpointCreated', 'Endpoint created'));} catch (err) {- toast.error(t('app.webhooksTab.failedToCreateEndpoint', 'Failed to create endpoint: {{message}}', { message: err.message }));+ toast.error(t('app.webhooksTab.failedToCreateEndpoint', 'Failed to create endpoint: {{message}}', { message: errorReason(err) }));}}@@ -91,7 +92,7 @@ export default function WebhooksTab() {loadAll();toast.success(t('app.webhooksTab.endpointDeleted', 'Endpoint deleted'));} catch (err) {- toast.error(t('app.webhooksTab.failedToDeleteEndpoint', 'Failed to delete endpoint: {{message}}', { message: err.message }));+ toast.error(t('app.webhooksTab.failedToDeleteEndpoint', 'Failed to delete endpoint: {{message}}', { message: errorReason(err) }));}}@@ -102,7 +103,7 @@ export default function WebhooksTab() {loadAll();if (selectedEndpoint?.id === id) openEndpoint(data.endpoint.id);} catch (err) {- toast.error(t('app.webhooksTab.regenerateFailed', 'Regenerate failed: {{message}}', { message: err.message }));+ toast.error(t('app.webhooksTab.regenerateFailed', 'Regenerate failed: {{message}}', { message: errorReason(err) }));}}@@ -113,7 +114,7 @@ export default function WebhooksTab() {setSelectedEndpoint(endpoint);setDeliveries(deliveries || []);} catch (err) {- toast.error(t('app.webhooksTab.failedToLoadEndpoint', 'Failed to load endpoint: {{message}}', { message: err.message }));+ toast.error(t('app.webhooksTab.failedToLoadEndpoint', 'Failed to load endpoint: {{message}}', { message: errorReason(err) }));}}@@ -129,7 +130,7 @@ export default function WebhooksTab() {toast.success(t('app.webhooksTab.replayedDelivery', 'Replayed delivery'));}} catch (err) {- toast.error(t('app.webhooksTab.replayFailed', 'Replay failed: {{message}}', { message: err.message }));+ toast.error(t('app.webhooksTab.replayFailed', 'Replay failed: {{message}}', { message: errorReason(err) }));}}diff --git a/frontend/src/components/settings/connections/ConnectionsHub.jsx b/frontend/src/components/settings/connections/ConnectionsHub.jsxindex 5ee1a22a..6d846a65 100644--- a/frontend/src/components/settings/connections/ConnectionsHub.jsx+++ b/frontend/src/components/settings/connections/ConnectionsHub.jsx@@ -23,6 +23,7 @@ import ProviderCard from './ProviderCard';import ErrorState from '../../ErrorState';import ConnectProviderModal from './ConnectProviderModal';import { useTranslation } from 'react-i18next';+import { toastError } from '@/utils/errorMessage';// The settings-index deep-link id each category section is landable from. The// cards are rendered by ProviderCard (presentational, no ref), so the flash@@ -125,7 +126,7 @@ export default function ConnectionsHub() {const { auth_url } = await api.startSourceConnection(provider.provider, redirectUri);window.location.href = auth_url;} catch (err) {- toast.error(err.message || t('app.connectionsHub.failedToStartConnection', 'Failed to start {{name}} connection', { name: provider.name }));+ toastError(toast, t('app.connectionsHub.failedToStartConnection', 'Failed to start {{name}} connection', { name: provider.name }), err);}}, [t, toast]);@@ -136,7 +137,7 @@ export default function ConnectionsHub() {await loadData();setModalOpen(false);} catch (err) {- toast.error(err.message || t('app.connectionsHub.failedToDisconnect', 'Failed to disconnect'));+ toastError(toast, t('app.connectionsHub.failedToDisconnect', 'Failed to disconnect'), err);}}, [toast, loadData, t]);@@ -160,7 +161,7 @@ export default function ConnectionsHub() {document.body.appendChild(form);form.submit();} catch (err) {- toast.error(err.message || t('app.connectionsHub.failedToStartGithubAppSetup', 'Failed to start GitHub App setup'));+ toastError(toast, t('app.connectionsHub.failedToStartGithubAppSetup', 'Failed to start GitHub App setup'), err);}}, [t, toast]);@@ -173,7 +174,7 @@ export default function ConnectionsHub() {await loadData();return true;} catch (err) {- toast.error(err.message || t('app.connectionsHub.failedToSaveOauthApp', 'Failed to save OAuth app'));+ toastError(toast, t('app.connectionsHub.failedToSaveOauthApp', 'Failed to save OAuth app'), err);return false;}}, [toast, t, loadData]);@@ -187,7 +188,7 @@ export default function ConnectionsHub() {await loadData();return true;} catch (err) {- toast.error(err.message || t('app.connectionsHub.failedToAddConnection', 'Failed to add connection'));+ toastError(toast, t('app.connectionsHub.failedToAddConnection', 'Failed to add connection'), err);return false;}}, [toast, loadData, t]);@@ -206,7 +207,7 @@ export default function ConnectionsHub() {await loadData();return true;} catch (err) {- toast.error(err.message || t('app.connectionsHub.failedToRemoveConnection', 'Failed to delete connection'));+ toastError(toast, t('app.connectionsHub.failedToRemoveConnection', 'Failed to delete connection'), err);return false;}}, [confirm, t, toast, loadData]);@@ -215,10 +216,10 @@ export default function ConnectionsHub() {try {const res = await api.testEmailDNSProvider(id);if (res && res.success) toast.success(res.message || t('app.connectionsHub.connectionWorks', 'Connection works'));- else toast.error((res && res.error) || t('app.connectionsHub.connectionTestFailed', 'Connection test failed'));+ else toastError(toast, t('app.connectionsHub.connectionTestFailed', 'Connection test failed'), res && res.error);return res;} catch (err) {- toast.error(err.message || t('app.connectionsHub.connectionTestFailed', 'Connection test failed'));+ toastError(toast, t('app.connectionsHub.connectionTestFailed', 'Connection test failed'), err);return null;}}, [t, toast]);@@ -231,7 +232,7 @@ export default function ConnectionsHub() {await loadData();return true;} catch (err) {- toast.error(err.message || t('app.connectionsHub.failedToConnectProvider', 'Failed to connect provider'));+ toastError(toast, t('app.connectionsHub.failedToConnectProvider', 'Failed to connect provider'), err);return false;}}, [toast, t, loadData]);@@ -250,7 +251,7 @@ export default function ConnectionsHub() {await loadData();return true;} catch (err) {- toast.error(err.message || t('app.connectionsHub.failedToDisconnect', 'Failed to disconnect'));+ toastError(toast, t('app.connectionsHub.failedToDisconnect', 'Failed to disconnect'), err);return false;}}, [confirm, t, toast, loadData]);@@ -264,7 +265,7 @@ export default function ConnectionsHub() {await loadData();return true;} catch (err) {- toast.error(err.message || t('app.connectionsHub.failedToSaveStorage', 'Failed to save storage'));+ toastError(toast, t('app.connectionsHub.failedToSaveStorage', 'Failed to save storage'), err);return false;}}, [toast, t, loadData]);@@ -273,10 +274,10 @@ export default function ConnectionsHub() {try {const res = await api.testStorageConnection(config);if (res && res.success) toast.success(res.message || t('app.connectionsHub.connectionWorks', 'Connection works'));- else toast.error((res && res.error) || t('app.connectionsHub.connectionTestFailed', 'Connection test failed'));+ else toastError(toast, t('app.connectionsHub.connectionTestFailed', 'Connection test failed'), res && res.error);return res;} catch (err) {- toast.error(err.message || t('app.connectionsHub.connectionTestFailed', 'Connection test failed'));+ toastError(toast, t('app.connectionsHub.connectionTestFailed', 'Connection test failed'), err);return null;}}, [t, toast]);@@ -289,7 +290,7 @@ export default function ConnectionsHub() {await loadData();return true;} catch (err) {- toast.error(err.message || t('app.connectionsHub.failedToSaveRelay', 'Failed to save relay'));+ toastError(toast, t('app.connectionsHub.failedToSaveRelay', 'Failed to save relay'), err);return false;}}, [toast, t, loadData]);@@ -298,10 +299,10 @@ export default function ConnectionsHub() {try {const res = await api.testEmailRelay(payload);if (res && res.success) toast.success(res.message || t('app.connectionsHub.connectionWorks', 'Connection works'));- else toast.error((res && res.error) || t('app.connectionsHub.connectionTestFailed', 'Connection test failed'));+ else toastError(toast, t('app.connectionsHub.connectionTestFailed', 'Connection test failed'), res && res.error);return res;} catch (err) {- toast.error(err.message || t('app.connectionsHub.connectionTestFailed', 'Connection test failed'));+ toastError(toast, t('app.connectionsHub.connectionTestFailed', 'Connection test failed'), err);return null;}}, [t, toast]);@@ -313,7 +314,7 @@ export default function ConnectionsHub() {await loadData();return true;} catch (err) {- toast.error(err.message || t('app.connectionsHub.failedToDisableRelay', 'Failed to disable relay'));+ toastError(toast, t('app.connectionsHub.failedToDisableRelay', 'Failed to disable relay'), err);return false;}}, [toast, t, loadData]);@@ -326,7 +327,7 @@ export default function ConnectionsHub() {await loadData();return true;} catch (err) {- toast.error(err.message || t('app.connectionsHub.failedToConnectRegistrar', 'Failed to connect registrar'));+ toastError(toast, t('app.connectionsHub.failedToConnectRegistrar', 'Failed to connect registrar'), err);return false;}}, [toast, t, loadData]);@@ -345,7 +346,7 @@ export default function ConnectionsHub() {await loadData();return true;} catch (err) {- toast.error(err.message || t('app.connectionsHub.failedToDisconnect', 'Failed to disconnect'));+ toastError(toast, t('app.connectionsHub.failedToDisconnect', 'Failed to disconnect'), err);return false;}}, [confirm, t, toast, loadData]);@@ -354,10 +355,10 @@ export default function ConnectionsHub() {try {const res = await api.testRegistrarConnection(id);if (res && res.success) toast.success(res.message || t('app.connectionsHub.connectionWorks', 'Connection works'));- else toast.error((res && res.error) || t('app.connectionsHub.connectionTestFailed', 'Connection test failed'));+ else toastError(toast, t('app.connectionsHub.connectionTestFailed', 'Connection test failed'), res && res.error);return res;} catch (err) {- toast.error(err.message || t('app.connectionsHub.connectionTestFailed', 'Connection test failed'));+ toastError(toast, t('app.connectionsHub.connectionTestFailed', 'Connection test failed'), err);return null;}}, [t, toast]);@@ -370,7 +371,7 @@ export default function ConnectionsHub() {await loadData();return true;} catch (err) {- toast.error(err.message || t('app.connectionsHub.failedToAddRegistry', 'Failed to add registry'));+ toastError(toast, t('app.connectionsHub.failedToAddRegistry', 'Failed to add registry'), err);return false;}}, [toast, t, loadData]);@@ -389,7 +390,7 @@ export default function ConnectionsHub() {await loadData();return true;} catch (err) {- toast.error(err.message || t('app.connectionsHub.failedToRemoveRegistry', 'Failed to delete registry'));+ toastError(toast, t('app.connectionsHub.failedToRemoveRegistry', 'Failed to delete registry'), err);return false;}}, [confirm, t, toast, loadData]);@@ -398,10 +399,10 @@ export default function ConnectionsHub() {try {const res = await api.testContainerRegistry(id);if (res && res.success) toast.success(res.message || t('app.connectionsHub.loginWorks', 'Login works'));- else toast.error((res && res.error) || t('app.connectionsHub.loginFailed', 'Login failed'));+ else toastError(toast, t('app.connectionsHub.loginFailed', 'Login failed'), res && res.error);return res;} catch (err) {- toast.error(err.message || t('app.connectionsHub.loginFailed', 'Login failed'));+ toastError(toast, t('app.connectionsHub.loginFailed', 'Login failed'), err);return null;}}, [t, toast]);diff --git a/frontend/src/components/shared/EnvironmentVariablesPanel.jsx b/frontend/src/components/shared/EnvironmentVariablesPanel.jsxindex 7800017b..b6a4087b 100644--- a/frontend/src/components/shared/EnvironmentVariablesPanel.jsx+++ b/frontend/src/components/shared/EnvironmentVariablesPanel.jsx@@ -2,6 +2,7 @@ import { useState, useEffect, useCallback } from 'react';import api from '../../services/api';import { useToast } from '../../contexts/useToast.js';import { useTranslation } from 'react-i18next';+import { toastError } from '@/utils/errorMessage';/*** Read-mostly facade showing the *resolved* shared variables for a resource —@@ -73,7 +74,7 @@ const EnvironmentVariablesPanel = ({ resourceType, resourceId }) => {resolved = data.variables || [];attachedGroups = data.groups || [];} catch (err) {- toast.error(t('app.environmentVariablesPanel.failedToLoadSharedVariables', 'Failed to load shared variables'));+ toastError(toast, t('app.environmentVariablesPanel.failedToLoadSharedVariables', 'Failed to load shared variables'), err);console.error('Failed to load resolved variables:', err);}}diff --git a/frontend/src/components/shared/SharedVariableGroups.jsx b/frontend/src/components/shared/SharedVariableGroups.jsxindex 67e56d8f..4f949d2a 100644--- a/frontend/src/components/shared/SharedVariableGroups.jsx+++ b/frontend/src/components/shared/SharedVariableGroups.jsx@@ -13,6 +13,7 @@ import { useTopbarActions } from '@/hooks/useTopbarActions';import { SearchField, Pill, ServiceTile } from '@/components/ds';import { useConfirm } from '@/hooks/useConfirm';import { useTranslation } from 'react-i18next';+import { toastError } from '@/utils/errorMessage';const RESOURCE_TYPES = ['application', 'database', 'service', 'wordpress', 'server'];@@ -91,8 +92,8 @@ const SharedVariableGroups = ({ scopeType = 'workspace', scopeId = 'default' })try {const data = await api.getVariableGroup(groupId);setDetail(data);- } catch {- toast.error(t('app.sharedVariableGroups.failedToLoadGroup', 'Failed to load group'));+ } catch (err) {+ toastError(toast, t('app.sharedVariableGroups.failedToLoadGroup', 'Failed to load group'), err);}}, [t, toast]);@@ -114,7 +115,7 @@ const SharedVariableGroups = ({ scopeType = 'workspace', scopeId = 'default' })await loadGroups();setSelectedId(group.id);} catch (err) {- toast.error(err.message || t('app.sharedVariableGroups.failedToCreateGroup', 'Failed to create group'));+ toastError(toast, t('app.sharedVariableGroups.failedToCreateGroup', 'Failed to create group'), err);}}@@ -130,7 +131,7 @@ const SharedVariableGroups = ({ scopeType = 'workspace', scopeId = 'default' })if (selectedId === groupId) setSelectedId(null);loadGroups();} catch (err) {- toast.error(err.message || t('app.sharedVariableGroups.failedToDeleteGroup', 'Failed to delete group'));+ toastError(toast, t('app.sharedVariableGroups.failedToDeleteGroup', 'Failed to delete group'), err);}}@@ -149,7 +150,7 @@ const SharedVariableGroups = ({ scopeType = 'workspace', scopeId = 'default' })loadDetail(selectedId);loadGroups();} catch (err) {- toast.error(err.message || t('app.sharedVariableGroups.failedToAddVariable', 'Failed to add variable'));+ toastError(toast, t('app.sharedVariableGroups.failedToAddVariable', 'Failed to add variable'), err);}}@@ -159,7 +160,7 @@ const SharedVariableGroups = ({ scopeType = 'workspace', scopeId = 'default' })loadDetail(selectedId);loadGroups();} catch (err) {- toast.error(err.message || t('app.sharedVariableGroups.failedToDeleteVariable', 'Failed to delete variable'));+ toastError(toast, t('app.sharedVariableGroups.failedToDeleteVariable', 'Failed to delete variable'), err);}}@@ -173,7 +174,7 @@ const SharedVariableGroups = ({ scopeType = 'workspace', scopeId = 'default' })loadDetail(selectedId);loadGroups();} catch (err) {- toast.error(err.message || t('app.sharedVariableGroups.failedToAttachGroup', 'Failed to attach group'));+ toastError(toast, t('app.sharedVariableGroups.failedToAttachGroup', 'Failed to attach group'), err);}}@@ -183,7 +184,7 @@ const SharedVariableGroups = ({ scopeType = 'workspace', scopeId = 'default' })loadDetail(selectedId);loadGroups();} catch (err) {- toast.error(err.message || t('app.sharedVariableGroups.failedToDetach', 'Failed to detach'));+ toastError(toast, t('app.sharedVariableGroups.failedToDetach', 'Failed to detach'), err);}}diff --git a/frontend/src/components/shared/TagsPanel.jsx b/frontend/src/components/shared/TagsPanel.jsxindex b305ccb7..9cb9ec18 100644--- a/frontend/src/components/shared/TagsPanel.jsx+++ b/frontend/src/components/shared/TagsPanel.jsx@@ -4,6 +4,7 @@ import { useToast } from '../../contexts/useToast.js';import { Button } from '@/components/ui/button';import { Input } from '@/components/ui/input';import { useTranslation } from 'react-i18next';+import { toastError } from '@/utils/errorMessage';/*** Reusable polymorphic tags panel for any resource.@@ -46,7 +47,7 @@ const TagsPanel = ({ resourceType, resourceId, readOnly = false }) => {setNewTag('');load();} catch (err) {- toast.error(err.message || t('app.tagsPanel.failedToAddTag', 'Failed to add tag'));+ toastError(toast, t('app.tagsPanel.failedToAddTag', 'Failed to add tag'), err);} finally {setSaving(false);}@@ -57,7 +58,7 @@ const TagsPanel = ({ resourceType, resourceId, readOnly = false }) => {await api.removeResourceTag(resourceType, resourceId, tag);setTags((prev) => prev.filter((t) => t.tag !== tag));} catch (err) {- toast.error(err.message || t('app.tagsPanel.failedToRemoveTag', 'Failed to remove tag'));+ toastError(toast, t('app.tagsPanel.failedToRemoveTag', 'Failed to remove tag'), err);}}diff --git a/frontend/src/components/workspaces/WorkspaceSettingsTab.jsx b/frontend/src/components/workspaces/WorkspaceSettingsTab.jsxindex 902f5726..ef5b9720 100644--- a/frontend/src/components/workspaces/WorkspaceSettingsTab.jsx+++ b/frontend/src/components/workspaces/WorkspaceSettingsTab.jsx@@ -10,6 +10,7 @@ import { SIDEBAR_ITEMS } from '../sidebarItems';import api from '../../services/api';import { useTranslation } from 'react-i18next';import { Card as SharedCard } from '@/components/ui/card';+import { toastError } from '@/utils/errorMessage';const SETTINGS_GROUPS = [{@@ -201,7 +202,7 @@ const WorkspaceSettingsTab = ({ wsId, ws, onUpdate, user, isCurrent, onSetActivetoast.success(t('app.workspaceSettingsTab.workspaceUpdated', 'Workspace updated'));onUpdate();} catch (err) {- toast.error(err.message || t('app.workspaceSettingsTab.failedToUpdateWorkspace', 'Failed to update workspace'));+ toastError(toast, t('app.workspaceSettingsTab.failedToUpdateWorkspace', 'Failed to update workspace'), err);} finally {setSaving(false);}diff --git a/frontend/src/hooks/useBackupSchedules.js b/frontend/src/hooks/useBackupSchedules.jsindex 09d51fd8..f291c966 100644--- a/frontend/src/hooks/useBackupSchedules.js+++ b/frontend/src/hooks/useBackupSchedules.js@@ -3,6 +3,7 @@ import { useTranslation } from 'react-i18next';import api from '../services/api';import { useToast } from '../contexts/useToast.js';import { useServerMutation, useServerQuery } from './useServerQuery';+import { toastError } from '@/utils/errorMessage';const SCHEDULE_KEY = ['backups', 'schedules'];const EMPTY_SCHEDULES = [];@@ -15,7 +16,7 @@ export function useBackupSchedules() {const toast = useToast();const query = useServerQuery(SCHEDULE_KEY, () => api.getBackupSchedules(), {refetchInterval: 60_000,- onError: (error) => toast.error(error.message),+ onError: (error) => toastError(toast, t('app.backups.couldntLoadSchedules', "Couldn't load backup schedules."), error),});const create = useServerMutation((values) => api.addBackupSchedule(values.name, values.backupType, values.target, values.scheduleTime,@@ -24,12 +25,12 @@ export function useBackupSchedules() {const toggle = useServerMutation((schedule) => api.updateBackupSchedule(schedule.id, { enabled: !schedule.enabled }), {invalidate: [SCHEDULE_KEY],onSuccess: (_, schedule) => toast.success(t('app.backups.schedule', 'Schedule {{value}}', { value: schedule.enabled ? 'disabled' : 'enabled' })),- onError: (error) => toast.error(error.message),+ onError: (error) => toastError(toast, t('app.backups.couldntToggleSchedule', "Couldn't turn the schedule on or off."), error),});const remove = useServerMutation((id) => api.removeBackupSchedule(id), {invalidate: [SCHEDULE_KEY],onSuccess: () => toast.success(t('app.backups.scheduleRemoved', 'Schedule deleted')),- onError: (error) => toast.error(error.message),+ onError: (error) => toastError(toast, t('app.backups.couldntDeleteSchedule', "Couldn't delete the schedule."), error),});const refetch = query.refetch;const reportError = toast.error;diff --git a/frontend/src/hooks/useRecipeCatalog.js b/frontend/src/hooks/useRecipeCatalog.jsindex 61454a7a..c92d6d74 100644--- a/frontend/src/hooks/useRecipeCatalog.js+++ b/frontend/src/hooks/useRecipeCatalog.js@@ -3,6 +3,7 @@ import { useTranslation } from 'react-i18next';import { api } from '../services/api';import { useToast } from '../contexts/useToast.js';import { useServerMutation, useServerQuery } from './useServerQuery';+import { toastError } from '@/utils/errorMessage';// Data door for the Recipe catalog (serverkit-recipes registry). Pages render// from this hook; raw api.* calls and query-layer error presentation stay here.@@ -18,9 +19,7 @@ export function useRecipeCatalog() {// The backend serves last-good/bundled when upstream is down, so// failures here are local (auth/network); surface once.staleTime: 60_000,- onError: () => toast.error(- t('app.recipes.loadFailed', 'Could not load the recipe catalog'),- ),+ onError: (err) => toastError(toast, t('app.recipes.loadFailed', 'Could not load the recipe catalog'), err),},);diff --git a/frontend/src/i18n/locales/en.json b/frontend/src/i18n/locales/en.jsonindex f724c1f9..7ab83503 100644--- a/frontend/src/i18n/locales/en.json+++ b/frontend/src/i18n/locales/en.json@@ -509,6 +509,11 @@"attach": "Attach","attachKind": "Attach {{kind}}","attached": "Attached. Redeploy to apply.",+ "couldntAttach": "Couldn't attach the service.",+ "couldntDetach": "Couldn't detach the service.",+ "couldntInstallAndAttach": "Couldn't install and attach the service.",+ "couldntLoadAttachable": "Couldn't load the services you can attach.",+ "couldntRedeploy": "Couldn't redeploy the service.","detach": "Detach","detachConnection": "The service loses the settings that point at the attached one.","detachStorage": "The service loses its key and S3 settings. The bucket and its files are kept.",@@ -619,6 +624,18 @@"configureDestination": "Configure destination","copyToRemoteStorage": "Copy to remote storage","cost": "Cost",+ "couldntCleanUp": "Couldn't clean up old backups.",+ "couldntConnectStorage": "Couldn't connect to the storage.",+ "couldntCreateBackup": "Couldn't create the backup.",+ "couldntDeleteBackup": "Couldn't delete the backup.",+ "couldntDeleteSchedule": "Couldn't delete the schedule.",+ "couldntLoadSchedules": "Couldn't load backup schedules.",+ "couldntRestore": "Couldn't restore the backup.",+ "couldntSaveConfig": "Couldn't save the backup settings.",+ "couldntSaveRates": "Couldn't save the storage cost rates.",+ "couldntSaveStorage": "Couldn't save the storage settings.",+ "couldntToggleSchedule": "Couldn't turn the schedule on or off.",+ "couldntUploadBackup": "Couldn't upload the backup to remote storage.","createBackup": "Create backup","customEndpointUrl": "Custom endpoint URL","dailyAppBackup": "Daily service backup",@@ -799,6 +816,10 @@"apiKey": "API key","autoInstallServerkitAgent": "Auto-install ServerKit agent","costs": "Costs",+ "couldntAddProvider": "Couldn't add the provider.",+ "couldntCreateServer": "Couldn't create the server.",+ "couldntDestroyServer": "Couldn't destroy the server.",+ "couldntLoadOptions": "Couldn't load the provider's options.","destroy": "Delete","destroyServer": "Delete server","destroyThisActionIsIrreversible": "Delete \"{{name}}\"? This action is irreversible.",@@ -1370,6 +1391,11 @@"cadence": "Cadence","configuration": "Settings","couldNotRestoreTheCronJob": "Could not restore the cron job",+ "couldntChangeTracking": "Couldn't change run tracking.",+ "couldntCreateJob": "Couldn't create the cron job.",+ "couldntDeleteJob": "Couldn't delete the cron job.",+ "couldntRunJob": "Couldn't run the cron job.",+ "couldntToggleJob": "Couldn't turn the cron job on or off.","createJob": "Create cron job","cronJob": "Cron job {{value}}","cronJobCreated": "Cron job created",@@ -1655,6 +1681,7 @@"cacheHitPg": "Buffer cache hit ratio","calls": "Calls","connections": "Connections",+ "couldntEnableStatements": "Couldn't turn on pg_stat_statements.","enable": "Enable pg_stat_statements","enableAndRestart": "Enable and restart","enableMessage": "PostgreSQL restarts once to load the extension; open connections drop. The change can be undone from the config tuner.",@@ -2326,6 +2353,7 @@"connectionInformation": "Connection information","connectionTestFailed": "Connection test failed: {{message}}","connections": "Connections",+ "couldntConnect": "Couldn't connect to the FTP server.","couldntRestartFtp": "Couldn't restart the FTP server. {{message}}","couldntStartFtp": "Couldn't start the FTP server. {{message}}","couldntStopFtp": "Couldn't stop the FTP server. {{message}}",@@ -3227,6 +3255,8 @@"configure2": "Configure {{displayname}}","couldntLoadInstalledExtensions": "Couldn't load installed extensions","couldntLoadTheCatalog": "Couldn't load the extension catalog",+ "couldntToggle": "Couldn't turn the extension on or off.",+ "couldntUninstall": "Couldn't uninstall the extension.","declaredPermissionsWhatThePanelHas": "Declared permissions, what the panel has observed, and pending Python dependencies","extensionConfigurationSaved": "Extension settings saved","extensionDisabled": "Extension disabled",@@ -3337,6 +3367,7 @@"clearMicroCache": "Clear micro-cache","clearThisSitesEntries": "Entries expire on their own after the cache lifetime; use this when a change must be visible now. Only this service's pages are cleared.","clearing": "Clearing…",+ "couldntUpdateImmutableAssets": "Couldn't update immutable asset caching.","enableMicroCache": "Enable micro-cache","failedToClearTheMicroCache": "Failed to clear the micro-cache","failedToUpdateMicroCache": "Failed to update micro-cache",@@ -3888,6 +3919,7 @@"deploymentSteps": "Deployment steps"},"pooler": {+ "couldntChangePooler": "Couldn't change the connection pooler.","hint": "Runs PgBouncer in transaction mode beside this database, so many client connections share a few server connections. Services opt in by referencing pooledUrl instead of connectionString.","off": "Pooler removed","on": "Pooler running at {{host}}:5432",@@ -4163,6 +4195,11 @@"allStatuses": "All statuses","attempts": "Attempts","attempts2": "Attempts:",+ "couldntDelete": "Couldn't delete the message.",+ "couldntLoadMessages": "Couldn't load messages.",+ "couldntLoadQueue": "Couldn't load the queue.",+ "couldntRequeue": "Couldn't requeue the message.",+ "couldntSend": "Couldn't send the message.","created2": "Created:","delayMs": "Delay (ms)","deleteMessage": "Delete message",@@ -4200,6 +4237,12 @@"areYouSureYouWantTo": "Delete \"{{value}}\"? This removes the queue and all its messages.","configJson": "Config (JSON)","configMustBeValidJson": "Config must be valid JSON",+ "couldntCreateGroup": "Couldn't create the group.",+ "couldntCreateQueue": "Couldn't create the queue.",+ "couldntDeleteQueue": "Couldn't delete the queue.",+ "couldntLoadQueues": "Couldn't load queues.",+ "couldntLoadStats": "Couldn't load queue stats.",+ "couldntSend": "Couldn't send the message.","createAQueueGroupAndQueue": "Create a queue group and queue to start sending messages.","createGroup": "Create group","createQueue": "Create queue",@@ -4982,6 +5025,10 @@"browseTheLibrary": "Browse the library","category": "Category","compliance": "Compliance",+ "couldntAssign": "Couldn't assign the template.",+ "couldntCreate": "Couldn't create the template.",+ "couldntCreateFromLibrary": "Couldn't add the template from the library.",+ "couldntDelete": "Couldn't delete the template.","couldntLoadTemplates": "Couldn't load templates","couldntLoadTheLibrary": "Couldn't load the template library","createTemplate": "Create template",@@ -6585,6 +6632,11 @@},"testSandbox": {"aRunIsAlreadyInProgress": "A run is already in progress.",+ "couldntCancel": "Couldn't cancel the run.",+ "couldntLoadRun": "Couldn't load the run.",+ "couldntLoadRuns": "Couldn't load runs.",+ "couldntRefreshRun": "Couldn't refresh the run.",+ "couldntStart": "Couldn't start the run.","debian": "Debian","distros": "Distros","dockerIsNotAvailableOnThis": "Docker is not available on this host. Test runs cannot start until the Docker daemon is reachable.",@@ -7102,7 +7154,16 @@"allWorkspaces": "All workspaces","applicationMovedIn": "Service moved in","applicationRemoved": "Service removed",+ "couldntAddMember": "Couldn't add the member.",+ "couldntArchive": "Couldn't archive the workspace.",+ "couldntDelete": "Couldn't delete the workspace.",+ "couldntGrant": "Couldn't grant access.","couldntLoadWorkspace": "Couldn't load this workspace",+ "couldntMoveServer": "Couldn't move the server.",+ "couldntMoveService": "Couldn't move the service.",+ "couldntRemoveMember": "Couldn't remove the member.",+ "couldntRestore": "Couldn't restore the workspace.",+ "couldntRevoke": "Couldn't revoke access.","deleteAllDataWillBeLost": "Delete \"{{name}}\"? All data will be lost.","deleteWorkspace": "Delete workspace","editorViewOperate": "Editor · view + operate",@@ -7191,6 +7252,7 @@},"workspaces": {"brandColor": "Brand color",+ "couldntCreate": "Couldn't create the workspace.","couldntLoadWorkspaces": "Couldn't load workspaces","createWorkspace": "New workspace","maxServers0Unlimited": "Max servers (0 = unlimited)",@@ -7300,8 +7362,14 @@},"error": {"failedToLoad": "Failed to load",+ "forbidden": "You don't have permission to do this.","loadingData": "An error occurred while loading data",+ "network": "The panel server didn't respond. Check your connection and that the server is running.",+ "notFound": "It doesn't exist anymore. Refresh the page.",+ "server": "The server hit an error. Try again, or check the server logs.",+ "timeout": "The server took too long to answer. Try again.","title": "Something went wrong",+ "unauthorized": "Your session ended. Sign in again.","unexpected": "An unexpected error occurred"},"labels": {diff --git a/frontend/src/pages/AgentFleet.jsx b/frontend/src/pages/AgentFleet.jsxindex 6d3a8ebd..2f704101 100644--- a/frontend/src/pages/AgentFleet.jsx+++ b/frontend/src/pages/AgentFleet.jsx@@ -37,6 +37,7 @@ const formatPercent = (value, digits) => {return `${digits == null ? value : value.toFixed(digits)}%`;};import { Card as SharedCard, CardHeader as SharedCardHeader, CardContent as SharedCardContent } from '@/components/ui/card';+import { toastError } from '@/utils/errorMessage';const AgentFleet = () => {const { t } = useTranslation();@@ -120,8 +121,8 @@ const AgentFleet = () => {const data = await api.getDiscoveredAgents();setDiscoveredAgents(data);toast.success(t('app.agentFleet.discoveredAgents', 'Discovered {{length}} agents', { length: data.length }));- } catch {- toast.error(t('app.agentFleet.discoveryScanFailed', 'Discovery scan failed'));+ } catch (err) {+ toastError(toast, t('app.agentFleet.discoveryScanFailed', 'Discovery scan failed'), err);} finally {setIsScanning(false);}@@ -132,8 +133,8 @@ const AgentFleet = () => {await api.approveRegistration(serverId);toast.success(t('app.agentFleet.agentRegistrationApproved', 'Agent registration approved'));fetchData();- } catch {- toast.error(t('app.agentFleet.failedToApproveAgent', 'Failed to approve agent'));+ } catch (err) {+ toastError(toast, t('app.agentFleet.failedToApproveAgent', 'Failed to approve agent'), err);}};@@ -142,8 +143,8 @@ const AgentFleet = () => {await api.rejectRegistration(serverId);toast.success(t('app.agentFleet.agentRegistrationRejected', 'Agent registration rejected'));fetchData();- } catch {- toast.error(t('app.agentFleet.failedToRejectAgent', 'Failed to reject agent'));+ } catch (err) {+ toastError(toast, t('app.agentFleet.failedToRejectAgent', 'Failed to reject agent'), err);}};@@ -168,8 +169,8 @@ const AgentFleet = () => {toast.success(t('app.agentFleet.stagedRolloutStarted', 'Staged rollout started'));}fetchData();- } catch {- toast.error(t('app.agentFleet.failedToTriggerUpgrade', 'Failed to trigger upgrade'));+ } catch (err) {+ toastError(toast, t('app.agentFleet.failedToTriggerUpgrade', 'Failed to trigger upgrade'), err);}};@@ -178,8 +179,8 @@ const AgentFleet = () => {await api.cancelRollout(rolloutId);toast.success(t('app.agentFleet.rolloutCancelled', 'Rollout cancelled'));fetchData();- } catch {- toast.error(t('app.agentFleet.failedToCancelRollout', 'Failed to cancel rollout'));+ } catch (err) {+ toastError(toast, t('app.agentFleet.failedToCancelRollout', 'Failed to cancel rollout'), err);}};@@ -188,8 +189,8 @@ const AgentFleet = () => {await api.retryCommand(commandId);toast.success(t('app.agentFleet.commandRetryTriggered', 'Command retry triggered'));fetchData();- } catch {- toast.error(t('app.agentFleet.failedToRetryCommand', 'Failed to retry command'));+ } catch (err) {+ toastError(toast, t('app.agentFleet.failedToRetryCommand', 'Failed to retry command'), err);}};@@ -197,8 +198,8 @@ const AgentFleet = () => {try {const data = await api.getServerDiagnostics(serverId);setDiagnostics(data);- } catch {- toast.error(t('app.agentFleet.failedToLoadDiagnostics', 'Failed to load diagnostics'));+ } catch (err) {+ toastError(toast, t('app.agentFleet.failedToLoadDiagnostics', 'Failed to load diagnostics'), err);}};diff --git a/frontend/src/pages/Backups.jsx b/frontend/src/pages/Backups.jsxindex 717419bb..3caea03e 100644--- a/frontend/src/pages/Backups.jsx+++ b/frontend/src/pages/Backups.jsx@@ -34,6 +34,7 @@ import { useColumnVisibility } from '@/hooks/useColumnVisibility';import { useTranslation } from 'react-i18next';import useFocusParam from '../hooks/useFocusParam';import { Card as SharedCard, CardHeader as SharedCardHeader, CardContent as SharedCardContent } from '@/components/ui/card';+import { toastError } from '@/utils/errorMessage';// `backups` is kept as an alias so old /backups/backups links still resolve to// the archive, which now answers to `snapshots`.@@ -290,7 +291,7 @@ const Backups = () => {resetBackupForm();loadData();} catch (err) {- toast.error(err.message);+ toastError(toast, t('app.backups.couldntCreateBackup', "Couldn't create the backup."), err);}};@@ -302,7 +303,7 @@ const Backups = () => {toast.success(t('app.backups.backupDeleted', 'Backup deleted'));loadData();} catch (err) {- toast.error(err.message);+ toastError(toast, t('app.backups.couldntDeleteBackup', "Couldn't delete the backup."), err);}};@@ -313,7 +314,7 @@ const Backups = () => {toast.success(t('app.backups.backupUploadedToRemoteStorage', 'Backup uploaded to remote storage'));loadData();} catch (err) {- toast.error(err.message);+ toastError(toast, t('app.backups.couldntUploadBackup', "Couldn't upload the backup to remote storage."), err);} finally {setUploadingBackup(null);}@@ -338,7 +339,7 @@ const Backups = () => {setSelectedBackup(null);toast.success(t('app.backups.backupRestoredSuccessfully', 'Backup restored'));} catch (err) {- toast.error(err.message);+ toastError(toast, t('app.backups.couldntRestore', "Couldn't restore the backup."), err);}};@@ -363,7 +364,7 @@ const Backups = () => {toast.success(t('app.backups.settingsSaved', 'Settings saved'));loadData();} catch (err) {- toast.error(err.message);+ toastError(toast, t('app.backups.couldntSaveConfig', "Couldn't save the backup settings."), err);}};@@ -380,7 +381,7 @@ const Backups = () => {const summary = await api.getBackupCostSummary().catch(() => null);setCostSummary(summary || null);} catch (err) {- toast.error(err.message);+ toastError(toast, t('app.backups.couldntSaveRates', "Couldn't save the storage cost rates."), err);} finally {setSavingRates(false);}@@ -393,7 +394,7 @@ const Backups = () => {toast.success(t('app.backups.storageConfigurationSaved', 'Storage settings saved'));loadData();} catch (err) {- toast.error(err.message);+ toastError(toast, t('app.backups.couldntSaveStorage', "Couldn't save the storage settings."), err);}};@@ -404,10 +405,10 @@ const Backups = () => {if (result.success) {toast.success(result.message);} else {- toast.error(result.error);+ toastError(toast, t('app.backups.couldntConnectStorage', "Couldn't connect to the storage."), result.error);}} catch (err) {- toast.error(err.message);+ toastError(toast, t('app.backups.couldntConnectStorage', "Couldn't connect to the storage."), err);} finally {setTestingConnection(false);}@@ -421,7 +422,7 @@ const Backups = () => {toast.success(result.message);loadData();} catch (err) {- toast.error(err.message);+ toastError(toast, t('app.backups.couldntCleanUp', "Couldn't clean up old backups."), err);}};diff --git a/frontend/src/pages/CloudProvision.jsx b/frontend/src/pages/CloudProvision.jsxindex c7760243..3136c596 100644--- a/frontend/src/pages/CloudProvision.jsx+++ b/frontend/src/pages/CloudProvision.jsx@@ -15,6 +15,7 @@ import { Badge } from '@/components/ui/badge';import { Tabs, TabsList, TabsTrigger, TabsContent } from '@/components/ui/tabs';import { Cloud, Server } from 'lucide-react';import { useTranslation } from 'react-i18next';+import { toastError } from '@/utils/errorMessage';const CloudProvision = () => {const { t } = useTranslation();@@ -42,8 +43,8 @@ const CloudProvision = () => {setProviders(pData.providers || []);setServers(sData.servers || []);setCosts(cData);- } catch {- toast.error(t('app.cloudProvision.failedToLoadCloudData', 'Failed to load cloud data'));+ } catch (err) {+ toastError(toast, t('app.cloudProvision.failedToLoadCloudData', 'Failed to load cloud data'), err);} finally {setLoading(false);}@@ -68,14 +69,14 @@ const CloudProvision = () => {toast.success(t('app.cloudProvision.providerAdded', 'Provider added'));setShowCreateProvider(false);loadData();- } catch (err) { toast.error(err.message); }+ } catch (err) { toastError(toast, t('app.cloudProvision.couldntAddProvider', "Couldn't add the provider."), err); }};const loadProviderOptions = async (type) => {try {const data = await api.getCloudProviderOptions(type);setProviderOptions(data);- } catch (err) { toast.error(err.message); }+ } catch (err) { toastError(toast, t('app.cloudProvision.couldntLoadOptions', "Couldn't load the provider's options."), err); }};const handleCreateServer = async () => {@@ -84,7 +85,7 @@ const CloudProvision = () => {toast.success(t('app.cloudProvision.serverProvisioningInitiated', 'Server provisioning initiated'));setShowCreateServer(false);loadData();- } catch (err) { toast.error(err.message); }+ } catch (err) { toastError(toast, t('app.cloudProvision.couldntCreateServer', "Couldn't create the server."), err); }};const handleDestroy = async (id) => {@@ -93,7 +94,7 @@ const CloudProvision = () => {toast.success(t('app.cloudProvision.serverDestroyed', 'Server deleted'));setDeleteConfirm(null);loadData();- } catch (err) { toast.error(err.message); }+ } catch (err) { toastError(toast, t('app.cloudProvision.couldntDestroyServer', "Couldn't destroy the server."), err); }};const providerTypes = {diff --git a/frontend/src/pages/CronJobs.jsx b/frontend/src/pages/CronJobs.jsxindex 2a46e622..8a2b140c 100644--- a/frontend/src/pages/CronJobs.jsx+++ b/frontend/src/pages/CronJobs.jsx@@ -23,6 +23,7 @@ import { useColumnVisibility } from '@/hooks/useColumnVisibility';import SchedulePicker from '../components/SchedulePicker';import PageLayout from '../layouts/PageLayout';import { useTranslation } from 'react-i18next';+import { toastError } from '@/utils/errorMessage';// A new job opens on a sane, non-destructive cadence rather than an empty// expression the picker would have to render as invalid.@@ -233,7 +234,7 @@ const CronJobs = () => {toast.success(t('app.cronJobs.cronJobRestored', 'Cron job "{{name}}" restored', { name: job.name }));loadData();} catch (err) {- toast.error(err.message || t('app.cronJobs.couldNotRestoreTheCronJob', 'Could not restore the cron job'));+ toastError(toast, t('app.cronJobs.couldNotRestoreTheCronJob', 'Could not restore the cron job'), err);}},},@@ -241,7 +242,7 @@ const CronJobs = () => {setDrawerJob(null);loadData();} catch (err) {- toast.error(err.message);+ toastError(toast, t('app.cronJobs.couldntDeleteJob', "Couldn't delete the cron job."), err);}};@@ -251,7 +252,7 @@ const CronJobs = () => {toast.success(t('app.cronJobs.cronJob', 'Cron job {{value}}', { value: !currentEnabled ? 'enabled' : 'disabled' }));loadData();} catch (err) {- toast.error(err.message);+ toastError(toast, t('app.cronJobs.couldntToggleJob', "Couldn't turn the cron job on or off."), err);}};@@ -269,10 +270,10 @@ const CronJobs = () => {});loadData();} else {- toast.error(result.error || t('app.cronJobs.jobExecutionFailed', 'Job execution failed'));+ toastError(toast, t('app.cronJobs.jobExecutionFailed', 'Job execution failed'), result.error);}} catch (err) {- toast.error(err.message);+ toastError(toast, t('app.cronJobs.couldntRunJob', "Couldn't run the cron job."), err);} finally {setRunningJobId(null);}@@ -624,7 +625,7 @@ function CronDrawer({ job, isAdmin, running, onClose, onRefresh, onRun, onEdit,onClose();onRefresh?.();} catch (err) {- toast.error(err.message);+ toastError(toast, t('app.cronJobs.couldntChangeTracking', "Couldn't change run tracking."), err);} finally {setTrackingBusy(false);}@@ -858,7 +859,7 @@ function CronFormDrawer({ open, job, onClose, onSaved }) {}onSaved();} catch (err) {- toast.error(err.message);+ toastError(toast, t('app.cronJobs.couldntCreateJob', "Couldn't create the cron job."), err);} finally {setSaving(false);}diff --git a/frontend/src/pages/Dashboard.jsx b/frontend/src/pages/Dashboard.jsxindex 2b727bd6..9af04d9f 100644--- a/frontend/src/pages/Dashboard.jsx+++ b/frontend/src/pages/Dashboard.jsx@@ -31,6 +31,7 @@ import useEditingSession from '../hooks/useEditingSession';import { useShortcut, useShortcutCommands } from '../hooks/useShortcut';import { useUnsavedChangesGuard } from '../hooks/useUnsavedChangesGuard';import { useTranslation } from 'react-i18next';+import { toastError } from '@/utils/errorMessage';// Auto-refresh choices, in seconds. 0 means "don't".const REFRESH_OPTIONS = [@@ -306,8 +307,8 @@ const Dashboard = () => {toast.success(t('app.dashboard.dashboardSaved', 'Dashboard saved'), {description: t('app.dashboard.widget', '{{length}} widget{{value}} · {{value2}}', { length: savedWidgets.length, value: savedWidgets.length === 1 ? '' : 's', value2: activeBoard?.name }),});- } catch {- toast.error(t('app.dashboard.couldNotSave', 'Could not save'), { description: t('app.dashboard.yourLayoutIsStillHereTry', 'Your layout is still here. Try again.') });+ } catch (err) {+ toastError(toast, t('app.dashboard.couldNotSave', 'Could not save'), err, { description: t('app.dashboard.yourLayoutIsStillHereTry', 'Your layout is still here. Try again.') });}}, [activeBoard?.name, saveActive, saveEditing, t, toast]);@@ -378,8 +379,8 @@ const Dashboard = () => {const board = await resetActiveBoard();resetEditing(board?.widgets || []);toast.info(t('app.dashboard.resetToTheShippedLayout', 'Reset to the shipped layout'), { description: activeBoard?.name });- } catch {- toast.error(t('app.dashboard.couldNotReset', 'Could not reset'), { description: t('app.dashboard.thisBoardHasNoShippedDefault', 'This board has no shipped default.') });+ } catch (err) {+ toastError(toast, t('app.dashboard.couldNotReset', 'Could not reset'), err, { description: t('app.dashboard.thisBoardHasNoShippedDefault', 'This board has no shipped default.') });}};diff --git a/frontend/src/pages/Databases.jsx b/frontend/src/pages/Databases.jsxindex ba893736..d2ad86fe 100644--- a/frontend/src/pages/Databases.jsx+++ b/frontend/src/pages/Databases.jsx@@ -44,6 +44,7 @@ import {DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger,} from '@/components/ui/dropdown-menu';import PageLayout from '@/layouts/PageLayout';+import { toastError } from '@/utils/errorMessage';// Cadence while an engine install is in flight.const ENGINE_POLL_MS = 4000;@@ -562,8 +563,8 @@ export default function Databases() {try {const res = node.engine === 'mysql' ? await api.backupMySQLDatabase(node.label) : await api.backupPostgreSQLDatabase(node.label);if (res.success) toast.success(t('app.databases.backupCreated', 'Backup created: {{backuppath}}', { backuppath: res.backup_path }));- } catch {- toast.error(t('app.databases.failedToCreateBackup', 'Failed to create backup'));+ } catch (err) {+ toastError(toast, t('app.databases.failedToCreateBackup', 'Failed to create backup'), err);}}@@ -582,8 +583,8 @@ export default function Databases() {const eng = roots.find((r) => r.engine === node.engine);if (eng) refresh(eng);setTabs((prev) => prev.filter((t) => !(t.conn && connKey(t.conn) === connKey(node.conn))));- } catch {- toast.error(t('app.databases.failedToDropDatabase', 'Failed to drop database'));+ } catch (err) {+ toastError(toast, t('app.databases.failedToDropDatabase', 'Failed to drop database'), err);}}diff --git a/frontend/src/pages/DeliveryLog.jsx b/frontend/src/pages/DeliveryLog.jsxindex 40b358a7..d2a4883c 100644--- a/frontend/src/pages/DeliveryLog.jsx+++ b/frontend/src/pages/DeliveryLog.jsx@@ -20,6 +20,7 @@ import { timeAgo } from '../utils/time';import EmailProviders from '../components/EmailProviders';import { usePolling } from '@/hooks/usePolling';import { useTranslation } from 'react-i18next';+import { errorReason } from '@/utils/errorMessage';const STATUSES = ['all', 'pending', 'sent', 'failed', 'skipped'];const CHANNELS = ['all', 'inapp', 'email', 'discord', 'slack', 'telegram', 'webhook'];@@ -118,7 +119,7 @@ export default function DeliveryLog() {toast.success(t('app.deliveryLog.deliveryReQueued', 'Delivery re-queued'));load();} catch (err) {- toast.error(t('app.deliveryLog.couldntRetryDelivery', "Couldn't retry the delivery. {{reason}}", { reason: err.message }));+ toast.error(t('app.deliveryLog.couldntRetryDelivery', "Couldn't retry the delivery. {{reason}}", { reason: errorReason(err) }));}};diff --git a/frontend/src/pages/Domains.jsx b/frontend/src/pages/Domains.jsxindex 8f05904b..07ea812f 100644--- a/frontend/src/pages/Domains.jsx+++ b/frontend/src/pages/Domains.jsx@@ -35,6 +35,7 @@ import PluginSlot from '../components/PluginSlot';import { formatExpiry } from '../utils/expiry';import { useTranslation } from 'react-i18next';import { t } from '../i18n/t';+import { toastError } from '@/utils/errorMessage';const DAY = 86400000;const norm = (s) => (s || '').toLowerCase().replace(/\.$/, '');@@ -603,7 +604,7 @@ const Domains = () => {if (!fromCurrent) grid.setCfg(grid.base);grid.views.saveView(name).then(() => toast.success(t('app.domains.viewSaved', 'View "{{name}}" saved', { name: name })))- .catch(() => toast.error(t('app.domains.couldNotSaveTheView', 'Could not save the view')));+ .catch((err) => toastError(toast, t('app.domains.couldNotSaveTheView', 'Could not save the view'), err));};// ── top bar ──────────────────────────────────────────────diff --git a/frontend/src/pages/Errors.jsx b/frontend/src/pages/Errors.jsxindex ce99dbcf..717ff454 100644--- a/frontend/src/pages/Errors.jsx+++ b/frontend/src/pages/Errors.jsx@@ -20,6 +20,7 @@ import { useToast } from '../contexts/useToast.js';import EmptyState from '../components/EmptyState';import { timeAgo } from '../utils/time';import { useTranslation } from 'react-i18next';+import { toastError } from '@/utils/errorMessage';const PAGE_SIZE = 50;@@ -157,7 +158,7 @@ export default function Errors() {setSelected(null);refresh();} catch (err) {- toast.error(err.message || t('app.errors.updateFailed', 'Update failed'));+ toastError(toast, t('app.errors.updateFailed', 'Update failed'), err);}};@@ -175,7 +176,7 @@ export default function Errors() {setSelected(null);refresh();} catch (err) {- toast.error(err.message || t('app.errors.deleteFailed', 'Delete failed'));+ toastError(toast, t('app.errors.deleteFailed', 'Delete failed'), err);}};diff --git a/frontend/src/pages/FTPServer.jsx b/frontend/src/pages/FTPServer.jsxindex 24729dad..5248cd25 100644--- a/frontend/src/pages/FTPServer.jsx+++ b/frontend/src/pages/FTPServer.jsx@@ -25,6 +25,7 @@ import { InfoList, InfoItem } from '../components/InfoList';import { Badge } from '@/components/ui/badge';import { Tabs, TabsList, TabsTrigger, TabsContent } from '@/components/ui/tabs';import { useTranslation } from 'react-i18next';+import { errorReason, toastError } from '@/utils/errorMessage';const VALID_TABS = ['overview', 'users', 'connections', 'logs'];@@ -175,9 +176,9 @@ function FTPServer() {await loadStatus();} catch (error) {const failed = {- start: t('app.fTPServer.couldntStartFtp', "Couldn't start the FTP server. {{message}}", { message: error.message }),- stop: t('app.fTPServer.couldntStopFtp', "Couldn't stop the FTP server. {{message}}", { message: error.message }),- restart: t('app.fTPServer.couldntRestartFtp', "Couldn't restart the FTP server. {{message}}", { message: error.message }),+ start: t('app.fTPServer.couldntStartFtp', "Couldn't start the FTP server. {{message}}", { message: errorReason(error) }),+ stop: t('app.fTPServer.couldntStopFtp', "Couldn't stop the FTP server. {{message}}", { message: errorReason(error) }),+ restart: t('app.fTPServer.couldntRestartFtp', "Couldn't restart the FTP server. {{message}}", { message: errorReason(error) }),};toast.error(failed[action] || error.message);} finally {@@ -193,7 +194,7 @@ function FTPServer() {setShowInstallModal(false);await loadData();} catch (error) {- toast.error(t('app.fTPServer.failedToInstall', 'Failed to install: {{message}}', { message: error.message }));+ toast.error(t('app.fTPServer.failedToInstall', 'Failed to install: {{message}}', { message: errorReason(error) }));} finally {setActionLoading(false);}@@ -213,7 +214,7 @@ function FTPServer() {setNewUser({ username: '', password: '', homeDir: '' });await loadUsers();} catch (error) {- toast.error(t('app.fTPServer.failedToCreateUser', 'Failed to create user: {{message}}', { message: error.message }));+ toast.error(t('app.fTPServer.failedToCreateUser', 'Failed to create user: {{message}}', { message: errorReason(error) }));} finally {setActionLoading(false);}@@ -231,7 +232,7 @@ function FTPServer() {toast.success(t('app.fTPServer.userDeletedSuccessfully', 'User deleted'));await loadUsers();} catch (error) {- toast.error(t('app.fTPServer.failedToDeleteUser', 'Failed to delete user: {{message}}', { message: error.message }));+ toast.error(t('app.fTPServer.failedToDeleteUser', 'Failed to delete user: {{message}}', { message: errorReason(error) }));}setConfirmDialog(null);},@@ -245,7 +246,7 @@ function FTPServer() {toast.success(t('app.fTPServer.userSuccessfully', 'User {{value}}', { value: currentStatus ? 'disabled' : 'enabled' }));await loadUsers();} catch (error) {- toast.error(t('app.fTPServer.failedToToggleUser', 'Failed to toggle user: {{message}}', { message: error.message }));+ toast.error(t('app.fTPServer.failedToToggleUser', 'Failed to toggle user: {{message}}', { message: errorReason(error) }));}};@@ -259,7 +260,7 @@ function FTPServer() {setPasswordTarget(null);setNewPassword('');} catch (error) {- toast.error(t('app.fTPServer.failedToChangePassword', 'Failed to change password: {{message}}', { message: error.message }));+ toast.error(t('app.fTPServer.failedToChangePassword', 'Failed to change password: {{message}}', { message: errorReason(error) }));} finally {setActionLoading(false);}@@ -271,7 +272,7 @@ function FTPServer() {toast.success(t('app.fTPServer.sessionDisconnected', 'Session disconnected'));await loadConnections();} catch (error) {- toast.error(t('app.fTPServer.failedToDisconnect', 'Failed to disconnect: {{message}}', { message: error.message }));+ toast.error(t('app.fTPServer.failedToDisconnect', 'Failed to disconnect: {{message}}', { message: errorReason(error) }));}};@@ -282,10 +283,10 @@ function FTPServer() {if (result.success) {toast.success(result.message);} else {- toast.error(result.error);+ toastError(toast, t('app.fTPServer.couldntConnect', "Couldn't connect to the FTP server."), result.error);}} catch (error) {- toast.error(t('app.fTPServer.connectionTestFailed', 'Connection test failed: {{message}}', { message: error.message }));+ toast.error(t('app.fTPServer.connectionTestFailed', 'Connection test failed: {{message}}', { message: errorReason(error) }));} finally {setActionLoading(false);}diff --git a/frontend/src/pages/FileManager.jsx b/frontend/src/pages/FileManager.jsxindex a120599e..63691026 100644--- a/frontend/src/pages/FileManager.jsx+++ b/frontend/src/pages/FileManager.jsx@@ -31,6 +31,7 @@ import { TREE_ROOTS, getFileType, formatBytes } from '../components/file-managerimport { useClipboard } from '@/hooks/useClipboard';import { useTranslation } from 'react-i18next';import { useTopbarActions } from '@/hooks/useTopbarActions';+import { errorReason } from '@/utils/errorMessage';// Demo rail shortcuts (Quick access) — one-click jumps to the paths people// actually visit on a ServerKit host. "Stack" starts at the default install@@ -404,7 +405,7 @@ function FileManager() {setDirError(null);} catch (error) {if (path !== lastValidPathRef.current) {- toast.error(t('app.fileManager.failedToLoadDirectory', 'Failed to load directory: {{message}}', { message: error.message }));+ toast.error(t('app.fileManager.failedToLoadDirectory', 'Failed to load directory: {{message}}', { message: errorReason(error) }));setCurrentPath(lastValidPathRef.current);} else {setEntries([]);@@ -504,7 +505,7 @@ function FileManager() {const data = await api.searchFiles(currentPath, searchQuery);setSearchResults(data.results || []);} catch (error) {- toast.error(t('app.fileManager.searchFailed', 'Search failed: {{message}}', { message: error.message }));+ toast.error(t('app.fileManager.searchFailed', 'Search failed: {{message}}', { message: errorReason(error) }));} finally {setLoading(false);}@@ -544,7 +545,7 @@ function FileManager() {const data = await fileApi.read(entry.path);setFileContent(data.content);} catch (error) {- toast.error(t('app.fileManager.failedToReadFile', 'Failed to read file: {{message}}', { message: error.message }));+ toast.error(t('app.fileManager.failedToReadFile', 'Failed to read file: {{message}}', { message: errorReason(error) }));}}}@@ -587,7 +588,7 @@ function FileManager() {setEditing(false);loadDirectory(currentPath);} catch (error) {- toast.error(t('app.fileManager.failedToSave', 'Failed to save: {{message}}', { message: error.message }));+ toast.error(t('app.fileManager.failedToSave', 'Failed to save: {{message}}', { message: errorReason(error) }));}};@@ -601,7 +602,7 @@ function FileManager() {setNewFileName('');loadDirectory(currentPath);} catch (error) {- toast.error(t('app.fileManager.failedToCreateFile', 'Failed to create file: {{message}}', { message: error.message }));+ toast.error(t('app.fileManager.failedToCreateFile', 'Failed to create file: {{message}}', { message: errorReason(error) }));}};@@ -624,7 +625,7 @@ function FileManager() {} catch { /* ignore */ }}} catch (error) {- toast.error(t('app.fileManager.failedToCreateFolder', 'Failed to create folder: {{message}}', { message: error.message }));+ toast.error(t('app.fileManager.failedToCreateFolder', 'Failed to create folder: {{message}}', { message: errorReason(error) }));}};@@ -671,7 +672,7 @@ function FileManager() {setNewName('');loadDirectory(currentPath);} catch (error) {- toast.error(t('app.fileManager.failedToRename', 'Failed to rename: {{message}}', { message: error.message }));+ toast.error(t('app.fileManager.failedToRename', 'Failed to rename: {{message}}', { message: errorReason(error) }));}};@@ -686,7 +687,7 @@ function FileManager() {setNewPermissions('');loadDirectory(currentPath);} catch (error) {- toast.error(t('app.fileManager.failed2', 'Failed: {{message}}', { message: error.message }));+ toast.error(t('app.fileManager.failed2', 'Failed: {{message}}', { message: errorReason(error) }));}};diff --git a/frontend/src/pages/FleetProxy.jsx b/frontend/src/pages/FleetProxy.jsxindex 3926df07..56381edc 100644--- a/frontend/src/pages/FleetProxy.jsx+++ b/frontend/src/pages/FleetProxy.jsx@@ -15,6 +15,7 @@ import {import EmptyState from '../components/EmptyState';import { useTranslation } from 'react-i18next';import { t } from '../i18n/t';+import { toastError } from '@/utils/errorMessage';// Fleet-wide reverse-proxy dashboard (Phase 4 of C6). Aggregates every// server's managed-proxy posture into one table: which proxy each server runs@@ -323,7 +324,7 @@ const FleetProxy = () => {setError(null);} catch (err) {setError(err.message || 'Failed to load fleet proxy overview');- toast.error(t('app.fleetProxy.failedToLoadFleetProxyOverview', 'Failed to load fleet proxy overview'));+ toastError(toast, t('app.fleetProxy.failedToLoadFleetProxyOverview', 'Failed to load fleet proxy overview'), err);} finally {setLoading(false);}diff --git a/frontend/src/pages/ImportWizard.jsx b/frontend/src/pages/ImportWizard.jsxindex 0a20883c..03d2b112 100644--- a/frontend/src/pages/ImportWizard.jsx+++ b/frontend/src/pages/ImportWizard.jsx@@ -19,6 +19,7 @@ import Spinner from '../components/Spinner';import ErrorState from '../components/ErrorState';import { usePolling } from '@/hooks/usePolling';import { useTranslation } from 'react-i18next';+import { errorReason } from '@/utils/errorMessage';const POLL_MS = 2000;@@ -276,7 +277,7 @@ function ImportWizard() {// Reflect the analyze kick-off immediately; the poller takes over.setImp((prev) => (prev ? { ...prev, status: 'analyzing' } : prev));} catch (error) {- toast.error(t('app.importWizard.importFailedToStart', 'Import failed to start: {{message}}', { message: error.message }));+ toast.error(t('app.importWizard.importFailedToStart', 'Import failed to start: {{message}}', { message: errorReason(error) }));} finally {setBusy(false);setUploadProgress(null);@@ -291,7 +292,7 @@ function ImportWizard() {setImp((prev) => (prev ? { ...prev, status: 'running', error: null } : prev));setStep(5);} catch (error) {- toast.error(t('app.importWizard.failedToStartTheImportRun', 'Failed to start the import run: {{message}}', { message: error.message }));+ toast.error(t('app.importWizard.failedToStartTheImportRun', 'Failed to start the import run: {{message}}', { message: errorReason(error) }));} finally {setBusy(false);}@@ -310,7 +311,7 @@ function ImportWizard() {setStep(3);}} catch (error) {- toast.error(t('app.importWizard.failedToLoadImport', 'Failed to load import: {{message}}', { message: error.message }));+ toast.error(t('app.importWizard.failedToLoadImport', 'Failed to load import: {{message}}', { message: errorReason(error) }));}};@@ -328,7 +329,7 @@ function ImportWizard() {await loadHistory();toast.success(t('app.importWizard.importDeleted', 'Import deleted'));} catch (error) {- toast.error(t('app.importWizard.failedToDeleteImport', 'Failed to delete import: {{message}}', { message: error.message }));+ toast.error(t('app.importWizard.failedToDeleteImport', 'Failed to delete import: {{message}}', { message: errorReason(error) }));}};@@ -538,7 +539,7 @@ function ImportWizard() {await api.analyzeImport(imp.id);setImp((prev) => (prev ? { ...prev, status: 'analyzing', error: null } : prev));} catch (error) {- toast.error(t('app.importWizard.failedToReAnalyse', 'Failed to re-analyse: {{message}}', { message: error.message }));+ toast.error(t('app.importWizard.failedToReAnalyse', 'Failed to re-analyse: {{message}}', { message: errorReason(error) }));}}}><RotateCcw size={14} /> {t('app.importWizard.reAnalyse', 'Re-analyse')}diff --git a/frontend/src/pages/Incidents.jsx b/frontend/src/pages/Incidents.jsxindex f8f95eff..5d76b4cd 100644--- a/frontend/src/pages/Incidents.jsx+++ b/frontend/src/pages/Incidents.jsx@@ -30,6 +30,7 @@ import { useTopbarActions, useTopbarChrome } from '@/hooks/useTopbarActions';import { METRIC_LABELS } from '../components/monitoring/fleetMetrics';import { impactTone, INCIDENT_STATES } from '../components/monitoring/monitorShared';import { useTranslation } from 'react-i18next';+import { toastError } from '@/utils/errorMessage';// Built-in views. This page used to carry THREE old affordances at once — a KPI// band whose tiles set a filter, an Active/Resolved/All segment row, and the@@ -184,7 +185,7 @@ export default function Incidents() {toast[count > 0 ? 'warning' : 'success'](`${count} host alert${count === 1 ? '' : 's'} firing`);await load();} catch (err) {- toast.error(err.message || t('app.incidents.alertCheckFailed', 'Alert check failed'));+ toastError(toast, t('app.incidents.alertCheckFailed', 'Alert check failed'), err);} finally {setChecking(false);}@@ -324,8 +325,8 @@ export default function Incidents() {? api.acknowledgeFleetAlert(item.alertId): api.resolveFleetAlert(item.alertId));await load();- } catch {- toast.error(t('app.incidents.failedToAlert', 'Failed to {{value}} alert', { value: action === 'ack' ? 'acknowledge' : 'resolve' }));+ } catch (err) {+ toastError(toast, t('app.incidents.failedToAlert', 'Failed to {{value}} alert', { value: action === 'ack' ? 'acknowledge' : 'resolve' }), err);}}, [load, t, toast]);@@ -341,7 +342,7 @@ export default function Incidents() {setSelected(null);await load();} catch (err) {- toast.error(err.message || t('app.incidents.couldNotPostTheUpdate', 'Could not post the update'));+ toastError(toast, t('app.incidents.couldNotPostTheUpdate', 'Could not post the update'), err);}};diff --git a/frontend/src/pages/Jobs.jsx b/frontend/src/pages/Jobs.jsxindex 36df11c3..6b6c7566 100644--- a/frontend/src/pages/Jobs.jsx+++ b/frontend/src/pages/Jobs.jsx@@ -33,6 +33,7 @@ import { useToast } from '../contexts/useToast.js';import { timeAgo } from '../utils/time';import { usePolling } from '@/hooks/usePolling';import { useTranslation } from 'react-i18next';+import { toastError } from '@/utils/errorMessage';const titleCase = (value = '') => value.charAt(0).toUpperCase() + value.slice(1);@@ -281,19 +282,19 @@ export default function Jobs() {const onRetry = async (id) => {try { await api.retryJob(id); toast.success(t('app.jobs.jobReQueued', 'Job re-queued')); load(); }- catch { toast.error(t('app.jobs.retryFailed', 'Retry failed')); }+ catch (err) { toastError(toast, t('app.jobs.retryFailed', 'Retry failed'), err); }};const onCancel = async (id) => {try { await api.cancelJob(id); toast.success(t('app.jobs.jobCancelled', 'Job cancelled')); load(); }- catch { toast.error(t('app.jobs.cancelFailed', 'Cancel failed')); }+ catch (err) { toastError(toast, t('app.jobs.cancelFailed', 'Cancel failed'), err); }};const onRunScheduled = async (id) => {try { await api.runScheduledJob(id); toast.success(t('app.jobs.scheduledJobTriggered', 'Scheduled job triggered')); load(); }- catch { toast.error(t('app.jobs.triggerFailed', 'Trigger failed')); }+ catch (err) { toastError(toast, t('app.jobs.triggerFailed', 'Trigger failed'), err); }};const onToggleScheduled = async (id, enabled) => {try { await api.setScheduledJobEnabled(id, enabled); load(); }- catch { toast.error(t('app.jobs.updateFailed', 'Update failed')); }+ catch (err) { toastError(toast, t('app.jobs.updateFailed', 'Update failed'), err); }};// Declared above the admin gate because useTableChrome is a hook and thediff --git a/frontend/src/pages/Marketplace.jsx b/frontend/src/pages/Marketplace.jsxindex e04ea8af..ca6760b6 100644--- a/frontend/src/pages/Marketplace.jsx+++ b/frontend/src/pages/Marketplace.jsx@@ -42,6 +42,7 @@ import { ExtensionBrandMark } from '../components/icons/ExtensionBrands';import { hasBrandMark, extensionCoverStyle } from '../components/icons/extensionBrandData';import { resolveExtensionIcon } from '../components/icons/ExtensionIcons';import { useTranslation } from 'react-i18next';+import { toastError } from '@/utils/errorMessage';const CATEGORIES = ['ai', 'games', 'monitoring', 'security', 'deployment', 'integration', 'ui', 'utility'];@@ -334,7 +335,7 @@ const Marketplace = () => {toast.success(t('app.marketplace.installedHotReloadShouldPickIt', 'Installed "{{displayname}}". Hot-reload should pick it up; restart backend if blueprint routes do not appear.', { displayname: result.display_name }));loadExtensions();} catch (err) {- toast.error(err.message || t('app.marketplace.localInstallFailed', 'Local install failed'));+ toastError(toast, t('app.marketplace.localInstallFailed', 'Local install failed'), err);} finally {setInstalling(false);}@@ -352,7 +353,7 @@ const Marketplace = () => {if (err.status === 409 && err.data?.requires_acknowledgment) {setRiskTarget({ slug, reason: err.data?.reason || 'unreviewed' });} else {- toast.error(err.message || t('app.marketplace.registryInstallFailed', 'Registry install failed'));+ toastError(toast, t('app.marketplace.registryInstallFailed', 'Registry install failed'), err);}} finally {setInstalling(false);@@ -408,7 +409,7 @@ const Marketplace = () => {toast.success(purge ? t('app.marketplace.extensionUninstalledDataPurged', 'Extension uninstalled; data deleted') : t('app.marketplace.extensionUninstalledDataKept', 'Extension uninstalled; data kept'));await loadExtensions();} catch (err) {- toast.error(err.message);+ toastError(toast, t('app.marketplace.couldntUninstall', "Couldn't uninstall the extension."), err);} finally {setBusyPlugin(null);}@@ -427,7 +428,7 @@ const Marketplace = () => {if (err.status === 409 && err.data?.requires_acknowledgment) {setRiskTarget({ updatePluginId: pluginId, reason: err.data?.reason || 'unsigned' });} else {- toast.error(err.message || t('app.marketplace.extensionUpdateFailed', 'Extension update failed'));+ toastError(toast, t('app.marketplace.extensionUpdateFailed', 'Extension update failed'), err);}} finally {setBusyPlugin(null);@@ -447,7 +448,7 @@ const Marketplace = () => {}await loadExtensions();} catch (err) {- toast.error(err.message);+ toastError(toast, t('app.marketplace.couldntToggle', "Couldn't turn the extension on or off."), err);} finally {setBusyPlugin(null);}@@ -1106,7 +1107,7 @@ const PluginConfigDialog = ({ plugin, onClose }) => {toast.success(t('app.marketplace.extensionConfigurationSaved', 'Extension settings saved'));onClose();} catch (err) {- toast.error(err.message || t('app.marketplace.failedToSaveConfiguration', 'Failed to save settings'));+ toastError(toast, t('app.marketplace.failedToSaveConfiguration', 'Failed to save settings'), err);} finally {setSaving(false);}diff --git a/frontend/src/pages/MonitorDetail.jsx b/frontend/src/pages/MonitorDetail.jsxindex 747baa64..773be8b8 100644--- a/frontend/src/pages/MonitorDetail.jsx+++ b/frontend/src/pages/MonitorDetail.jsx@@ -34,6 +34,7 @@ import { useTableSort } from '@/hooks/useTableSort';import { useColumnVisibility } from '@/hooks/useColumnVisibility';import { usePolling } from '@/hooks/usePolling';import { useTranslation } from 'react-i18next';+import { toastError } from '@/utils/errorMessage';const POLL_MS = 15000;@@ -356,7 +357,7 @@ export default function MonitorDetail() {if (successMessage) toast.success(successMessage);await load();} catch (err) {- toast.error(err.message || t('app.monitorDetail.actionFailed', 'Action failed'));+ toastError(toast, t('app.monitorDetail.actionFailed', 'Action failed'), err);} finally {setBusy(false);}@@ -387,7 +388,7 @@ export default function MonitorDetail() {toast.success(t('app.monitorDetail.monitorDeleted', 'Monitor deleted'));navigate('/monitoring/monitors');} catch (err) {- toast.error(err.message || t('app.monitorDetail.couldNotDeleteTheMonitor', 'Could not delete the monitor'));+ toastError(toast, t('app.monitorDetail.couldNotDeleteTheMonitor', 'Could not delete the monitor'), err);}};diff --git a/frontend/src/pages/Monitoring.jsx b/frontend/src/pages/Monitoring.jsxindex 93820ba0..c765f38b 100644--- a/frontend/src/pages/Monitoring.jsx+++ b/frontend/src/pages/Monitoring.jsx@@ -22,6 +22,7 @@ import {Activity, Bell, Cpu, Gauge as GaugeIcon, HardDrive, MemoryStick,PlayCircle, RefreshCw, Settings,} from 'lucide-react';+import { toastError } from '@/utils/errorMessage';// One section per top-bar tab. There is deliberately no second tab strip inside// the page: the group's own bar (MONITOR_TABS) carries these, the way the@@ -200,7 +201,7 @@ const Monitoring = () => {toast.success(t('app.monitoring.monitoringDeliverySaved', 'Monitoring delivery saved'));await loadData();} catch (err) {- toast.error(err.message || t('app.monitoring.failedToSaveMonitoringSettings', 'Failed to save monitoring settings'));+ toastError(toast, t('app.monitoring.failedToSaveMonitoringSettings', 'Failed to save monitoring settings'), err);} finally {setSavingConfig(false);}@@ -219,7 +220,7 @@ const Monitoring = () => {toast.success(t('app.monitoring.alertRulesSaved', 'Alert rules saved'));await loadData();} catch (err) {- toast.error(err.message || t('app.monitoring.failedToSaveAlertRules', 'Failed to save alert rules'));+ toastError(toast, t('app.monitoring.failedToSaveAlertRules', 'Failed to save alert rules'), err);} finally {setSavingThresholds(false);}@@ -236,14 +237,14 @@ const Monitoring = () => {const res = await loadSpeedTest();const latest = res?.last_result;if (latest?.tested_at && latest.tested_at !== previousTestedAt) {- if (latest.success === false) toast.error(latest.error || t('app.monitoring.speedTestFailed', 'Speed test failed'));+ if (latest.success === false) toastError(toast, t('app.monitoring.speedTestFailed', 'Speed test failed'), latest.error);else toast.success(t('app.monitoring.speedTestComplete', 'Speed test complete'));return;}}toast.warning(t('app.monitoring.speedTestIsStillRunningRefresh', 'Speed test is still running. Refresh in a moment.'));} catch (err) {- toast.error(err.message || t('app.monitoring.failedToStartSpeedTest', 'Failed to start speed test'));+ toastError(toast, t('app.monitoring.failedToStartSpeedTest', 'Failed to start speed test'), err);} finally {setSpeedTestRunning(false);}diff --git a/frontend/src/pages/Monitors.jsx b/frontend/src/pages/Monitors.jsxindex d68900f5..ddb50cad 100644--- a/frontend/src/pages/Monitors.jsx+++ b/frontend/src/pages/Monitors.jsx@@ -39,6 +39,7 @@ import useFocusParam from '@/hooks/useFocusParam';import { CHECK_TYPES, MONITOR_STATUS, monitorStateOf } from '../components/monitoring/monitorShared';import { usePolling } from '@/hooks/usePolling';import { useTranslation } from 'react-i18next';+import { toastError } from '@/utils/errorMessage';const POLL_MS = 15000;@@ -279,7 +280,7 @@ export default function Monitors() {setFormOpen(false);load();} catch (err) {- toast.error(err.message || t('app.monitors.couldNotCreateTheMonitor', 'Could not create the monitor'));+ toastError(toast, t('app.monitors.couldNotCreateTheMonitor', 'Could not create the monitor'), err);} finally {setSaving(false);}@@ -291,7 +292,7 @@ export default function Monitors() {toast.success(monitor.is_paused ? t('app.monitors.resumed', 'Resumed {{name}}', { name: monitor.name }) : t('app.monitors.paused', 'Paused {{name}}', { name: monitor.name }));load();} catch (err) {- toast.error(err.message || t('app.monitors.couldNotChangeTheMonitor', 'Could not change the monitor'));+ toastError(toast, t('app.monitors.couldNotChangeTheMonitor', 'Could not change the monitor'), err);}};@@ -306,7 +307,7 @@ export default function Monitors() {}));load();} catch (err) {- toast.error(err.message || t('app.monitors.checkFailed', 'Check failed'));+ toastError(toast, t('app.monitors.checkFailed', 'Check failed'), err);}};diff --git a/frontend/src/pages/ProjectDetail.jsx b/frontend/src/pages/ProjectDetail.jsxindex 393af377..d36acee6 100644--- a/frontend/src/pages/ProjectDetail.jsx+++ b/frontend/src/pages/ProjectDetail.jsx@@ -23,6 +23,7 @@ import { Label } from '@/components/ui/label';import { Badge } from '@/components/ui/badge';import Modal from '@/components/Modal';import { useTranslation } from 'react-i18next';+import { toastError } from '@/utils/errorMessage';const ProjectDetail = () => {const { t } = useTranslation();@@ -84,7 +85,7 @@ const ProjectDetail = () => {try {await api.reorderEnvironments(Number(id), next.map(e => e.id));} catch (err) {- toast.error(err.message || t('app.projectDetail.failedToReorderEnvironments', 'Failed to reorder environments'));+ toastError(toast, t('app.projectDetail.failedToReorderEnvironments', 'Failed to reorder environments'), err);loadProject();}}@@ -97,7 +98,7 @@ const ProjectDetail = () => {setDeleteEnv(null);loadProject();} catch (err) {- toast.error(err.message || t('app.projectDetail.failedToDeleteEnvironment', 'Failed to delete environment'));+ toastError(toast, t('app.projectDetail.failedToDeleteEnvironment', 'Failed to delete environment'), err);setDeleteEnv(null);}}@@ -329,7 +330,7 @@ const CreateEnvironmentDialog = ({ projectId, open, onOpenChange, onCreated }) =setName('');onCreated();} catch (err) {- toast.error(err.message || t('app.projectDetail.failedToCreateEnvironment', 'Failed to create environment'));+ toastError(toast, t('app.projectDetail.failedToCreateEnvironment', 'Failed to create environment'), err);} finally {setSubmitting(false);}diff --git a/frontend/src/pages/Projects.jsx b/frontend/src/pages/Projects.jsxindex c338fea9..b83955d1 100644--- a/frontend/src/pages/Projects.jsx+++ b/frontend/src/pages/Projects.jsx@@ -13,6 +13,7 @@ import { Label } from '@/components/ui/label';import { Textarea } from '@/components/ui/textarea';import Modal from '@/components/Modal';import { useTranslation } from 'react-i18next';+import { toastError } from '@/utils/errorMessage';// Preset views. A project list is short, so these are about SHAPE rather than// status: which projects are actually carrying anything, and which are empty@@ -213,7 +214,7 @@ const CreateProjectDialog = ({ open, onOpenChange, onCreated }) => {reset();onCreated();} catch (err) {- toast.error(err.message || t('app.projects.failedToCreateProject', 'Failed to create project'));+ toastError(toast, t('app.projects.failedToCreateProject', 'Failed to create project'), err);} finally {setSubmitting(false);}diff --git a/frontend/src/pages/QueueDetail.jsx b/frontend/src/pages/QueueDetail.jsxindex d54f3d09..a9061570 100644--- a/frontend/src/pages/QueueDetail.jsx+++ b/frontend/src/pages/QueueDetail.jsx@@ -33,6 +33,7 @@ import { useTableSort } from '@/hooks/useTableSort';import { useColumnVisibility } from '@/hooks/useColumnVisibility';import { usePolling } from '@/hooks/usePolling';import { useTranslation } from 'react-i18next';+import { toastError } from '@/utils/errorMessage';const STATUS_ORDER = ['pending', 'in_flight', 'completed', 'failed', 'dead_letter'];@@ -139,12 +140,12 @@ const QueueDetail = () => {setQueue(queueRes.queue || null);setGroup(groupRes?.group || null);} catch (err) {- toast.error(err.message);+ toastError(toast, t('app.queueDetail.couldntLoadQueue', "Couldn't load the queue."), err);navigate('/queue');} finally {setLoading(false);}- }, [groupSlug, queueSlug, navigate, toast]);+ }, [groupSlug, queueSlug, navigate, t, toast]);const loadMessages = useCallback(async (status) => {try {@@ -154,9 +155,9 @@ const QueueDetail = () => {});setMessages(res.messages || []);} catch (err) {- toast.error(err.message);+ toastError(toast, t('app.queueDetail.couldntLoadMessages', "Couldn't load messages."), err);}- }, [groupSlug, queueSlug, toast]);+ }, [groupSlug, queueSlug, t, toast]);useEffect(() => {loadMeta();@@ -186,8 +187,8 @@ const QueueDetail = () => {let payload = {};try {payload = JSON.parse(sendForm.payload);- } catch {- toast.error(t('app.queueDetail.payloadMustBeValidJson', 'Payload must be valid JSON'));+ } catch (err) {+ toastError(toast, t('app.queueDetail.payloadMustBeValidJson', 'Payload must be valid JSON'), err);return;}try {@@ -200,7 +201,7 @@ const QueueDetail = () => {setSendForm({ payload: '{}', priority: 0, delay_ms: 0 });loadMessages(statusFilter);} catch (err) {- toast.error(err.message);+ toastError(toast, t('app.queueDetail.couldntSend', "Couldn't send the message."), err);}};@@ -210,7 +211,7 @@ const QueueDetail = () => {toast.success(t('app.queueDetail.messageRequeued', 'Message requeued'));loadMessages(statusFilter);} catch (err) {- toast.error(err.message);+ toastError(toast, t('app.queueDetail.couldntRequeue', "Couldn't requeue the message."), err);}};@@ -227,7 +228,7 @@ const QueueDetail = () => {if (selectedMessage?.id === msg.id) setSelectedMessage(null);loadMessages(statusFilter);} catch (err) {- toast.error(err.message);+ toastError(toast, t('app.queueDetail.couldntDelete', "Couldn't delete the message."), err);}};diff --git a/frontend/src/pages/QueueOperations.jsx b/frontend/src/pages/QueueOperations.jsxindex 9ca5e7f7..88f228be 100644--- a/frontend/src/pages/QueueOperations.jsx+++ b/frontend/src/pages/QueueOperations.jsx@@ -37,6 +37,7 @@ import { useColumnVisibility } from '@/hooks/useColumnVisibility';import { formatCompact, formatFull } from '../utils/formatNumber';import { usePolling } from '@/hooks/usePolling';import { useTranslation } from 'react-i18next';+import { toastError } from '@/utils/errorMessage';// Radix Select items cannot use '' — stands in for "no group filter".const ALL_GROUPS = '__all';@@ -147,11 +148,11 @@ const QueueOperations = () => {setGroups(groupsRes.groups || []);setStats(statsRes);} catch (err) {- toast.error(err.message);+ toastError(toast, t('app.queueOperations.couldntLoadStats', "Couldn't load queue stats."), err);} finally {setLoading(false);}- }, [toast]);+ }, [t, toast]);const loadQueues = useCallback(async (groupSlug) => {try {@@ -166,9 +167,9 @@ const QueueOperations = () => {);setQueues(lists.flat());} catch (err) {- toast.error(err.message);+ toastError(toast, t('app.queueOperations.couldntLoadQueues', "Couldn't load queues."), err);}- }, [groups, toast]);+ }, [groups, t, toast]);useEffect(() => {loadData();@@ -233,7 +234,7 @@ const QueueOperations = () => {setGroupForm({ name: '', description: '' });loadData();} catch (err) {- toast.error(err.message);+ toastError(toast, t('app.queueOperations.couldntCreateGroup', "Couldn't create the group."), err);}};@@ -247,8 +248,8 @@ const QueueOperations = () => {let config = {};try {config = JSON.parse(queueForm.config);- } catch {- toast.error(t('app.queueOperations.configMustBeValidJson', 'Config must be valid JSON'));+ } catch (err) {+ toastError(toast, t('app.queueOperations.configMustBeValidJson', 'Config must be valid JSON'), err);return;}try {@@ -263,7 +264,7 @@ const QueueOperations = () => {loadQueues(selectedGroup);loadData();} catch (err) {- toast.error(err.message);+ toastError(toast, t('app.queueOperations.couldntCreateQueue', "Couldn't create the queue."), err);}};@@ -280,7 +281,7 @@ const QueueOperations = () => {loadQueues(selectedGroup);loadData();} catch (err) {- toast.error(err.message);+ toastError(toast, t('app.queueOperations.couldntDeleteQueue', "Couldn't delete the queue."), err);}};@@ -299,8 +300,8 @@ const QueueOperations = () => {let payload = {};try {payload = JSON.parse(sendForm.payload);- } catch {- toast.error(t('app.queueOperations.payloadMustBeValidJson', 'Payload must be valid JSON'));+ } catch (err) {+ toastError(toast, t('app.queueOperations.payloadMustBeValidJson', 'Payload must be valid JSON'), err);return;}try {@@ -313,7 +314,7 @@ const QueueOperations = () => {loadQueues(selectedGroup);loadData();} catch (err) {- toast.error(err.message);+ toastError(toast, t('app.queueOperations.couldntSend', "Couldn't send the message."), err);}};diff --git a/frontend/src/pages/RemoteAccess.jsx b/frontend/src/pages/RemoteAccess.jsxindex 1a088eec..fb6b8344 100644--- a/frontend/src/pages/RemoteAccess.jsx+++ b/frontend/src/pages/RemoteAccess.jsx@@ -19,6 +19,7 @@ import { Input } from '@/components/ui/input';import { Label } from '@/components/ui/label';import { Switch } from '@/components/ui/switch';import { useTranslation } from 'react-i18next';+import { toastError } from '@/utils/errorMessage';// Tunnel / service status → status-pill tone.const pillKind = (status) => statusKind(status);@@ -79,7 +80,7 @@ const RemoteAccess = ({ serverId }) => {);setServices(Object.fromEntries(entries));} catch (e) {- toast.error(e.message || t('app.remoteAccess.failedToLoadTunnels', 'Failed to load tunnels'));+ toastError(toast, t('app.remoteAccess.failedToLoadTunnels', 'Failed to load tunnels'), e);} finally {setLoading(false);}@@ -149,7 +150,7 @@ const RemoteAccess = ({ serverId }) => {closeWizard();load();} catch (e) {- toast.error(e.message || t('app.remoteAccess.failedToExposeService', 'Failed to expose service'));+ toastError(toast, t('app.remoteAccess.failedToExposeService', 'Failed to expose service'), e);} finally {setSubmitting(false);}@@ -163,7 +164,7 @@ const RemoteAccess = ({ serverId }) => {setTeardown(null);load();} catch (e) {- toast.error(e.message || t('app.remoteAccess.failedToTearDownTunnel', 'Failed to tear down tunnel'));+ toastError(toast, t('app.remoteAccess.failedToTearDownTunnel', 'Failed to tear down tunnel'), e);}};@@ -173,7 +174,7 @@ const RemoteAccess = ({ serverId }) => {toast.success(t('app.remoteAccess.removed', 'Removed {{hostname}}', { hostname: svc.hostname }));load();} catch (e) {- toast.error(e.message || t('app.remoteAccess.failedToRemoveService', 'Failed to remove service'));+ toastError(toast, t('app.remoteAccess.failedToRemoveService', 'Failed to remove service'), e);}};diff --git a/frontend/src/pages/SSLCertificates.jsx b/frontend/src/pages/SSLCertificates.jsxindex a17ef5c8..ab739d25 100644--- a/frontend/src/pages/SSLCertificates.jsx+++ b/frontend/src/pages/SSLCertificates.jsx@@ -23,6 +23,7 @@ import {import DomainField from '../components/DomainField';import { formatExpiry } from '../utils/expiry';import { useTranslation } from 'react-i18next';+import { toastError } from '@/utils/errorMessage';const DAY = 86400000;@@ -173,10 +174,10 @@ const SSLCertificates = () => {setWildcard(false);loadData();} else {- toast.error(result.error || t('app.sSLCertificates.failedToObtainCertificate', 'Failed to obtain certificate'));+ toastError(toast, t('app.sSLCertificates.failedToObtainCertificate', 'Failed to obtain certificate'), result.error);}} catch (err) {- toast.error(err.message || t('app.sSLCertificates.failedToObtainCertificate', 'Failed to obtain certificate'));+ toastError(toast, t('app.sSLCertificates.failedToObtainCertificate', 'Failed to obtain certificate'), err);} finally {setActionLoading(false);}@@ -198,10 +199,10 @@ const SSLCertificates = () => {setUploadChain('');loadData();} else {- toast.error(result?.error || t('app.sSLCertificates.failedToUploadCertificate', 'Failed to upload certificate'));+ toastError(toast, t('app.sSLCertificates.failedToUploadCertificate', 'Failed to upload certificate'), result?.error);}} catch (err) {- toast.error(err.message || t('app.sSLCertificates.failedToUploadCertificate', 'Failed to upload certificate'));+ toastError(toast, t('app.sSLCertificates.failedToUploadCertificate', 'Failed to upload certificate'), err);} finally {setActionLoading(false);}@@ -215,10 +216,10 @@ const SSLCertificates = () => {toast.success(t('app.sSLCertificates.certificateForRenewed', 'Certificate for {{domain}} renewed', { domain: domain }));loadData();} else {- toast.error(result.error || t('app.sSLCertificates.renewalFailed', 'Renewal failed'));+ toastError(toast, t('app.sSLCertificates.renewalFailed', 'Renewal failed'), result.error);}} catch (err) {- toast.error(err.message || t('app.sSLCertificates.renewalFailed', 'Renewal failed'));+ toastError(toast, t('app.sSLCertificates.renewalFailed', 'Renewal failed'), err);} finally {setRenewingDomain(null);}@@ -232,10 +233,10 @@ const SSLCertificates = () => {toast.success(t('app.sSLCertificates.allCertificatesRenewed', 'All certificates renewed'));loadData();} else {- toast.error(result.error || t('app.sSLCertificates.renewalFailed', 'Renewal failed'));+ toastError(toast, t('app.sSLCertificates.renewalFailed', 'Renewal failed'), result.error);}} catch (err) {- toast.error(err.message || t('app.sSLCertificates.renewalFailed', 'Renewal failed'));+ toastError(toast, t('app.sSLCertificates.renewalFailed', 'Renewal failed'), err);} finally {setActionLoading(false);}@@ -252,10 +253,10 @@ const SSLCertificates = () => {toast.success(t('app.sSLCertificates.certificateForRevoked', 'Certificate for {{domain}} revoked', { domain: domain }));loadData();} else {- toast.error(result.error || t('app.sSLCertificates.revocationFailed', 'Revocation failed'));+ toastError(toast, t('app.sSLCertificates.revocationFailed', 'Revocation failed'), result.error);}} catch (err) {- toast.error(err.message || t('app.sSLCertificates.revocationFailed', 'Revocation failed'));+ toastError(toast, t('app.sSLCertificates.revocationFailed', 'Revocation failed'), err);} finally {setActionLoading(false);}@@ -268,10 +269,10 @@ const SSLCertificates = () => {if (result.success) {toast.success(result.message || t('app.sSLCertificates.autoRenewalConfigured', 'Auto-renewal configured'));} else {- toast.error(result.error || t('app.sSLCertificates.failedToSetupAutoRenewal', 'Failed to setup auto-renewal'));+ toastError(toast, t('app.sSLCertificates.failedToSetupAutoRenewal', 'Failed to setup auto-renewal'), result.error);}} catch (err) {- toast.error(err.message || t('app.sSLCertificates.failedToSetupAutoRenewal', 'Failed to setup auto-renewal'));+ toastError(toast, t('app.sSLCertificates.failedToSetupAutoRenewal', 'Failed to setup auto-renewal'), err);} finally {setActionLoading(false);}@@ -286,10 +287,10 @@ const SSLCertificates = () => {toast.success(t('app.sSLCertificates.certbotInstalledSuccessfully', 'Certbot installed'));loadData();} else {- toast.error(result.error || t('app.sSLCertificates.failedToInstallCertbot', 'Failed to install Certbot'));+ toastError(toast, t('app.sSLCertificates.failedToInstallCertbot', 'Failed to install Certbot'), result.error);}} catch (err) {- toast.error(err.message || t('app.sSLCertificates.failedToInstallCertbot', 'Failed to install Certbot'));+ toastError(toast, t('app.sSLCertificates.failedToInstallCertbot', 'Failed to install Certbot'), err);} finally {setActionLoading(false);}diff --git a/frontend/src/pages/ServerDetail.jsx b/frontend/src/pages/ServerDetail.jsxindex 0d211f35..c8680ba6 100644--- a/frontend/src/pages/ServerDetail.jsx+++ b/frontend/src/pages/ServerDetail.jsx@@ -31,6 +31,7 @@ import { usePolling } from '@/hooks/usePolling';import { useTranslation } from 'react-i18next';import { useAuth } from '../contexts/useAuth.js';import ServerRestorePointsTab from '../components/serverdetail/ServerRestorePointsTab';+import { toastError } from '@/utils/errorMessage';// Live host metrics cadence while the server is online.const METRICS_POLL_MS = 10000;@@ -132,8 +133,8 @@ const ServerDetail = () => {setSecurityAlerts(prev => prev.map(a =>a.id === alertId ? { ...a, status: 'acknowledged' } : a));- } catch {- toast.error(t('app.serverDetail.failedToAcknowledgeAlert', 'Failed to acknowledge alert'));+ } catch (err) {+ toastError(toast, t('app.serverDetail.failedToAcknowledgeAlert', 'Failed to acknowledge alert'), err);}}@@ -141,8 +142,8 @@ const ServerDetail = () => {try {await api.resolveAlert(alertId);setSecurityAlerts(prev => prev.filter(a => a.id !== alertId));- } catch {- toast.error(t('app.serverDetail.failedToResolveAlert', 'Failed to resolve alert'));+ } catch (err) {+ toastError(toast, t('app.serverDetail.failedToResolveAlert', 'Failed to resolve alert'), err);}}@@ -166,7 +167,7 @@ const ServerDetail = () => {toast.success(t('app.serverDetail.serverRemovedSuccessfully', 'Server removed'));navigate('/servers');} catch (err) {- toast.error(err.message || t('app.serverDetail.failedToRemoveServer', 'Failed to remove server'));+ toastError(toast, t('app.serverDetail.failedToRemoveServer', 'Failed to remove server'), err);}}@@ -179,8 +180,8 @@ const ServerDetail = () => {} else {toast.error(t('app.serverDetail.serverDidNotRespond', 'Server did not respond'));}- } catch {- toast.error(t('app.serverDetail.failedToPingServer', 'Failed to ping server'));+ } catch (err) {+ toastError(toast, t('app.serverDetail.failedToPingServer', 'Failed to ping server'), err);}}diff --git a/frontend/src/pages/ServerTemplates.jsx b/frontend/src/pages/ServerTemplates.jsxindex b7821f6b..f47517bd 100644--- a/frontend/src/pages/ServerTemplates.jsx+++ b/frontend/src/pages/ServerTemplates.jsx@@ -25,6 +25,7 @@ import {useTableChrome, GridViewPicker, GridChips, GridFilterButton,GridToolsMenu, GridFilterDrawer,} from '@/components/ds/grid';+import { toastError } from '@/utils/errorMessage';// Two surfaces, two treatments — on purpose.//@@ -292,7 +293,7 @@ const ServerTemplates = () => {setShowCreateModal(false);loadData();} catch (err) {- toast.error(err.message);+ toastError(toast, t('app.serverTemplates.couldntCreate', "Couldn't create the template."), err);}};@@ -302,7 +303,7 @@ const ServerTemplates = () => {toast.success(t('app.serverTemplates.templateCreatedFromLibrary', 'Template created from library'));loadData();} catch (err) {- toast.error(err.message);+ toastError(toast, t('app.serverTemplates.couldntCreateFromLibrary', "Couldn't add the template from the library."), err);}};@@ -313,7 +314,7 @@ const ServerTemplates = () => {setDeleteConfirm(null);loadData();} catch (err) {- toast.error(err.message);+ toastError(toast, t('app.serverTemplates.couldntDelete', "Couldn't delete the template."), err);}};@@ -324,7 +325,7 @@ const ServerTemplates = () => {setShowAssignModal(false);loadData();} catch (err) {- toast.error(err.message);+ toastError(toast, t('app.serverTemplates.couldntAssign', "Couldn't assign the template."), err);}};diff --git a/frontend/src/pages/Servers.jsx b/frontend/src/pages/Servers.jsxindex 2869bfb3..d94c9602 100644--- a/frontend/src/pages/Servers.jsx+++ b/frontend/src/pages/Servers.jsx@@ -27,6 +27,7 @@ import useFocusParam from '@/hooks/useFocusParam';import LinkPanelForm from '../components/servers/LinkPanelForm';import { useTranslation } from 'react-i18next';import { t } from '../i18n/t';+import { toastError } from '@/utils/errorMessage';// Radix Select items cannot use '' — stands in for "no group".const NO_GROUP = '__none';@@ -501,7 +502,7 @@ const Servers = () => {setSelectedIds(new Set());loadData();} catch (err) {- toast.error(err.message || t('app.servers.couldNotSetTheGroup', 'Could not set the group'));+ toastError(toast, t('app.servers.couldNotSetTheGroup', 'Could not set the group'), err);} finally {setBulkBusy(false);}@@ -1012,7 +1013,7 @@ const ManageGroupsModal = ({ groups, onClose, onUpdated }) => {const data = await api.getServerGroups();setGroupList(Array.isArray(data) ? data : []);} catch (err) {- toast.error(err.message || t('app.servers.failedToCreateGroup', 'Failed to create group'));+ toastError(toast, t('app.servers.failedToCreateGroup', 'Failed to create group'), err);} finally {setLoading(false);}@@ -1027,7 +1028,7 @@ const ManageGroupsModal = ({ groups, onClose, onUpdated }) => {const data = await api.getServerGroups();setGroupList(Array.isArray(data) ? data : []);} catch (err) {- toast.error(err.message || t('app.servers.failedToUpdateGroup', 'Failed to update group'));+ toastError(toast, t('app.servers.failedToUpdateGroup', 'Failed to update group'), err);}}@@ -1045,7 +1046,7 @@ const ManageGroupsModal = ({ groups, onClose, onUpdated }) => {const data = await api.getServerGroups();setGroupList(Array.isArray(data) ? data : []);} catch (err) {- toast.error(err.message || t('app.servers.failedToDeleteGroup', 'Failed to delete group'));+ toastError(toast, t('app.servers.failedToDeleteGroup', 'Failed to delete group'), err);}}diff --git a/frontend/src/pages/ServiceDetail.jsx b/frontend/src/pages/ServiceDetail.jsxindex fdcd7887..d68c6e65 100644--- a/frontend/src/pages/ServiceDetail.jsx+++ b/frontend/src/pages/ServiceDetail.jsx@@ -29,6 +29,7 @@ import { Pill, ServiceTile, PageTopbar, statusKind } from '@/components/ds';import FavoriteStar from '@/components/FavoriteStar';import { useRecordVisit } from '@/hooks/useRecordVisit';import { useTranslation } from 'react-i18next';+import { toastError } from '@/utils/errorMessage';const TAB_LABELS = {overview: 'Overview',@@ -76,7 +77,7 @@ const ServiceDetail = () => {const { id, tab: rawTab } = useParams();const navigate = useNavigate();const toast = useToast();- const toastError = toast.error;+ const showError = toast.error;const { confirm } = useConfirm();const { service, deployConfig, loading, error, reload, performAction, deleteService } = useService(id);// Active tab lives in the URL (/services/:id/:tab) so it's shareable and@@ -117,9 +118,9 @@ const ServiceDetail = () => {setVersions(data.versions || []);setCurrentVersion(data.current);})- .catch(() => toastError(t('app.serviceDetail.failedToLoadVersions', 'Failed to load versions')))+ .catch((err) => toastError(showError, t('app.serviceDetail.failedToLoadVersions', 'Failed to load versions'), err)).finally(() => setVersionsLoading(false));- }, [service?.source, id, toastError, t]);+ }, [service?.source, id, showError, t]);// Close menus on outside clickuseEffect(() => {@@ -153,7 +154,7 @@ const ServiceDetail = () => {stop: t('app.serviceDetail.couldntStopService', "Couldn't stop the service."),restart: t('app.serviceDetail.couldntRestartService', "Couldn't restart the service."),};- toast.error(err?.data?.error || err?.message || failed[action] || t('app.serviceDetail.couldntUpdateService', "Couldn't update the service"));+ toastError(toast, failed[action] || t('app.serviceDetail.couldntUpdateService', "Couldn't update the service"), err);} finally {setActionLoading(null);setShowDeployMenu(false);@@ -185,7 +186,7 @@ const ServiceDetail = () => {toast.success(t('app.serviceDetail.deploymentStarted', 'Deployment started'));await reload();} catch (err) {- toast.error(err.message || t('app.serviceDetail.failedToDeployLatestCommit', 'Failed to deploy latest commit'));+ toastError(toast, t('app.serviceDetail.failedToDeployLatestCommit', 'Failed to deploy latest commit'), err);} finally {setActionLoading(null);setShowDeployMenu(false);@@ -202,7 +203,7 @@ const ServiceDetail = () => {setVersions(data.versions || []);setCurrentVersion(data.current);} catch (err) {- toast.error(err.message || t('app.serviceDetail.failedToRollback', 'Failed to rollback'));+ toastError(toast, t('app.serviceDetail.failedToRollback', 'Failed to rollback'), err);} finally {setActionLoading(null);}@@ -225,7 +226,7 @@ const ServiceDetail = () => {setVersions(data.versions || []);setCurrentVersion(data.current);} catch (err) {- toast.error(err.message || t('app.serviceDetail.failedToUploadNewVersion', 'Failed to upload new version'));+ toastError(toast, t('app.serviceDetail.failedToUploadNewVersion', 'Failed to upload new version'), err);} finally {setActionLoading(null);}@@ -242,7 +243,7 @@ const ServiceDetail = () => {await deleteService();navigate('/services');} catch (err) {- toast.error(err?.data?.error || err?.message || t('app.serviceDetail.failedToDeleteService', 'Failed to delete service'));+ toastError(toast, t('app.serviceDetail.failedToDeleteService', 'Failed to delete service'), err);setActionLoading(null);}}diff --git a/frontend/src/pages/Services.jsx b/frontend/src/pages/Services.jsxindex 10589d77..e84fc9e8 100644--- a/frontend/src/pages/Services.jsx+++ b/frontend/src/pages/Services.jsx@@ -21,6 +21,7 @@ import {import Modal from '@/components/Modal';import RequiresDocker from '../components/RequiresDocker';import { useTranslation } from 'react-i18next';+import { toastError } from '@/utils/errorMessage';// Severity order for status sorting — also the page's default row order.const STATUS_SORT_ORDER = { running: 0, deploying: 1, building: 2, stopped: 3, failed: 4 };@@ -145,8 +146,8 @@ const Services = () => {else if (action === 'stop') await api.stopApp(appId);else if (action === 'restart') await api.restartApp(appId);await loadApps();- } catch {- toast.error(t('app.services.failedToService', 'Failed to {{action}} service', { action: action }));+ } catch (err) {+ toastError(toast, t('app.services.failedToService', 'Failed to {{action}} service', { action: action }), err);} finally {setActionLoading(null);}@@ -166,8 +167,8 @@ const Services = () => {toast.success(t('app.services.sentToServiceS', '{{action}} sent to {{size}} service(s)', { action: action, size: selectedIds.size }));setSelectedIds(new Set());await loadApps();- } catch {- toast.error(t('app.services.bulkFailed', 'Bulk {{action}} failed', { action: action }));+ } catch (err) {+ toastError(toast, t('app.services.bulkFailed', 'Bulk {{action}} failed', { action: action }), err);} finally {setBulkLoading(false);}@@ -442,7 +443,7 @@ const Services = () => {setSelectedIds(new Set());await loadApps();} catch (err) {- toast.error(err.message || t('app.services.failedToMoveServices', 'Failed to move services'));+ toastError(toast, t('app.services.failedToMoveServices', 'Failed to move services'), err);} finally {setBulkLoading(false);}@@ -459,7 +460,7 @@ const Services = () => {const MoveToProjectDialog = ({ open, onOpenChange, count, onMove }) => {const { t } = useTranslation();const toast = useToast();- const toastError = toast.error;+ const showError = toast.error;const [projects, setProjects] = useState([]);const [environments, setEnvironments] = useState([]);const [projectValue, setProjectValue] = useState(UNASSIGN);@@ -477,9 +478,9 @@ const MoveToProjectDialog = ({ open, onOpenChange, count, onMove }) => {setLoadingProjects(true);api.getProjects().then((data) => setProjects(Array.isArray(data?.projects) ? data.projects : []))- .catch(() => toastError(t('app.services.failedToLoadProjects', 'Failed to load projects')))+ .catch((err) => toastError(showError, t('app.services.failedToLoadProjects', 'Failed to load projects'), err)).finally(() => setLoadingProjects(false));- }, [open, toastError, t]);+ }, [open, showError, t]);async function handleProjectChange(value) {setProjectValue(value);@@ -491,8 +492,8 @@ const MoveToProjectDialog = ({ open, onOpenChange, count, onMove }) => {const data = await api.getProject(value);const envs = Array.isArray(data?.project?.environments) ? data.project.environments : [];setEnvironments(envs);- } catch {- toast.error(t('app.services.failedToLoadEnvironments', 'Failed to load environments'));+ } catch (err) {+ toastError(toast, t('app.services.failedToLoadEnvironments', 'Failed to load environments'), err);} finally {setLoadingEnvs(false);}diff --git a/frontend/src/pages/StatusPages.jsx b/frontend/src/pages/StatusPages.jsxindex 71215f32..54bf3fb6 100644--- a/frontend/src/pages/StatusPages.jsx+++ b/frontend/src/pages/StatusPages.jsx@@ -29,6 +29,7 @@ import {Trash2,Unlink,} from 'lucide-react';+import { toastError } from '@/utils/errorMessage';// pill → ds Pill kind · tone → .status-dot modifier · dot → .comp-dots squareconst STATUS_META = {@@ -160,7 +161,7 @@ const StatusPages = () => {setIncidents(iData.incidents || []);setUnattached((mData?.monitors || []).filter((m) => m.page_id == null));} catch (err) {- toast.error(err.message || t('app.statusPages.failedToLoadPageDetails', 'Failed to load page details'));+ toastError(toast, t('app.statusPages.failedToLoadPageDetails', 'Failed to load page details'), err);}};@@ -173,7 +174,7 @@ const StatusPages = () => {setShowAttach(false);await loadPageDetails(selectedPage);} catch (err) {- toast.error(err.message || t('app.statusPages.couldNotAddTheMonitor', 'Could not add the monitor'));+ toastError(toast, t('app.statusPages.couldNotAddTheMonitor', 'Could not add the monitor'), err);}};@@ -185,7 +186,7 @@ const StatusPages = () => {toast.success(t('app.statusPages.removedFromThisPage', '{{name}} removed from this page', { name: component.name }));await loadPageDetails(selectedPage);} catch (err) {- toast.error(err.message || t('app.statusPages.couldNotRemoveTheMonitor', 'Could not remove the monitor'));+ toastError(toast, t('app.statusPages.couldNotRemoveTheMonitor', 'Could not remove the monitor'), err);}};@@ -208,7 +209,7 @@ const StatusPages = () => {setIncidents([]);}} catch (err) {- toast.error(err.message || t('app.statusPages.failedToLoadStatusPages', 'Failed to load status pages'));+ toastError(toast, t('app.statusPages.failedToLoadStatusPages', 'Failed to load status pages'), err);} finally {setLoading(false);}@@ -243,7 +244,7 @@ const StatusPages = () => {setPages((current) => [...current, page].sort((a, b) => a.name.localeCompare(b.name)));await loadPageDetails(page);} catch (err) {- toast.error(err.message || t('app.statusPages.failedToCreateStatusPage', 'Failed to create status page'));+ toastError(toast, t('app.statusPages.failedToCreateStatusPage', 'Failed to create status page'), err);}};@@ -257,7 +258,7 @@ const StatusPages = () => {await loadPageDetails(selectedPage);await loadPages();} catch (err) {- toast.error(err.message || t('app.statusPages.failedToAddComponent', 'Failed to add component'));+ toastError(toast, t('app.statusPages.failedToAddComponent', 'Failed to add component'), err);}};@@ -267,7 +268,7 @@ const StatusPages = () => {toast.success(t('app.statusPages.check', 'Check {{status}}{{value}}', { status: result.status, value: result.response_time ? ` in ${result.response_time}ms` : '' }));if (selectedPage) await loadPageDetails(selectedPage);} catch (err) {- toast.error(err.message || t('app.statusPages.checkFailed', 'Check failed'));+ toastError(toast, t('app.statusPages.checkFailed', 'Check failed'), err);}};@@ -280,7 +281,7 @@ const StatusPages = () => {setIncidentForm(defaultIncidentForm);await loadPageDetails(selectedPage);} catch (err) {- toast.error(err.message || t('app.statusPages.failedToCreateIncident', 'Failed to create incident'));+ toastError(toast, t('app.statusPages.failedToCreateIncident', 'Failed to create incident'), err);}};@@ -294,7 +295,7 @@ const StatusPages = () => {toast.success(t('app.statusPages.incidentSetTo', 'Incident set to {{statusLabel}}', { statusLabel: statusLabel }));if (selectedPage) await loadPageDetails(selectedPage);} catch (err) {- toast.error(err.message || t('app.statusPages.failedToUpdateIncident', 'Failed to update incident'));+ toastError(toast, t('app.statusPages.failedToUpdateIncident', 'Failed to update incident'), err);}};@@ -325,7 +326,7 @@ const StatusPages = () => {setDeleteConfirm(null);if (selectedPage) await loadPageDetails(selectedPage);} catch (err) {- toast.error(err.message || t('app.statusPages.deleteFailed', 'Delete failed'));+ toastError(toast, t('app.statusPages.deleteFailed', 'Delete failed'), err);}};diff --git a/frontend/src/pages/Telemetry.jsx b/frontend/src/pages/Telemetry.jsxindex 8101fa40..fab2175b 100644--- a/frontend/src/pages/Telemetry.jsx+++ b/frontend/src/pages/Telemetry.jsx@@ -43,6 +43,7 @@ import EmptyState from '../components/EmptyState';import ErrorState from '../components/ErrorState';import { statusKind } from '@/components/ds/status';import { useTranslation } from 'react-i18next';+import { errorReason } from '@/utils/errorMessage';const SEVERITY_ORDER = ['critical', 'error', 'warning', 'info', 'debug'];@@ -111,7 +112,7 @@ const BUILTIN_VIEWS = [export default function Telemetry() {const { t } = useTranslation();const { isAdmin } = useAuth();- const { success: toastSuccess, error: toastError } = useToast();+ const { success: toastSuccess, error: showError } = useToast();const { confirm } = useConfirm();const [events, setEvents] = useState([]);@@ -195,7 +196,7 @@ export default function Telemetry() {toastSuccess(t('app.telemetry.testEventEmitted', 'Test event emitted'));fetchEvents(1, true);} catch (err) {- toastError(t('app.telemetry.failedToEmitTestEvent', 'Failed to emit test event: {{message}}', { message: err.message }));+ showError(t('app.telemetry.failedToEmitTestEvent', 'Failed to emit test event: {{message}}', { message: errorReason(err) }));}};@@ -214,7 +215,7 @@ export default function Telemetry() {toastSuccess(t('app.telemetry.deletedOldEvents', 'Deleted {{deleted}} old events', { deleted: data.deleted }));fetchEvents(1, true);} catch (err) {- toastError(t('app.telemetry.cleanupFailed', 'Cleanup failed: {{message}}', { message: err.message }));+ showError(t('app.telemetry.cleanupFailed', 'Cleanup failed: {{message}}', { message: errorReason(err) }));}};diff --git a/frontend/src/pages/Templates.jsx b/frontend/src/pages/Templates.jsxindex 81484680..f95f4ea4 100644--- a/frontend/src/pages/Templates.jsx+++ b/frontend/src/pages/Templates.jsx@@ -30,6 +30,7 @@ import ErrorState from '../components/ErrorState';import { useManagedProfile } from '../contexts/useManagedProfile';import ManagedCard from '../components/ManagedCard';import { useTranslation } from 'react-i18next';+import { toastError } from '@/utils/errorMessage';// Featured templates (curated list)const FEATURED_TEMPLATES = [@@ -225,7 +226,7 @@ const Templates = () => {const { t } = useTranslation();const navigate = useNavigate();const toast = useToast();- const toastError = toast.error;+ const showError = toast.error;const [searchParams, setSearchParams] = useSearchParams();const [templates, setTemplates] = useState([]);@@ -292,10 +293,10 @@ const Templates = () => {if (result.template) {setSelectedTemplate(result.template);}- } catch {- toastError(t('app.templates.failedToLoadTemplateDetails', 'Failed to load template details'));+ } catch (err) {+ toastError(showError, t('app.templates.failedToLoadTemplateDetails', 'Failed to load template details'), err);}- }, [navigate, t, toastError]);+ }, [navigate, t, showError]);useEffect(() => {loadCategories();@@ -419,8 +420,8 @@ const Templates = () => {setSelectedTemplate(result.template);setShowInstallModal(true);}- } catch {- toast.error(t('app.templates.failedToLoadTemplateDetails', 'Failed to load template details'));+ } catch (err) {+ toastError(toast, t('app.templates.failedToLoadTemplateDetails', 'Failed to load template details'), err);}}diff --git a/frontend/src/pages/Terminal.jsx b/frontend/src/pages/Terminal.jsxindex 84508d96..13dc7546 100644--- a/frontend/src/pages/Terminal.jsx+++ b/frontend/src/pages/Terminal.jsx@@ -35,6 +35,7 @@ import { Button as SharedButton } from '@/components/ui/button';import {Select, SelectTrigger, SelectContent, SelectItem, SelectValue,} from '@/components/ui/select';+import { errorReason } from '@/utils/errorMessage';// 'logs' stays first so the default landing keeps working on installs with no// paired agents (the interactive shell needs a connected agent).@@ -321,7 +322,7 @@ const LogFilesTab = () => {toast.success(t('app.terminal.logFileTruncated', 'Log file truncated'));loadLogFiles();} catch (err) {- toast.error(t('app.terminal.failed', 'Failed: {{message}}', { message: err.message }));+ toast.error(t('app.terminal.failed', 'Failed: {{message}}', { message: errorReason(err) }));}}@@ -847,7 +848,7 @@ const ProcessesTab = () => {setLastUpdated(new Date());} catch (err) {console.error('Failed to load processes:', err);- toast.error(t('app.terminal.failed', 'Failed: {{message}}', { message: err.message }));+ toast.error(t('app.terminal.failed', 'Failed: {{message}}', { message: errorReason(err) }));} finally {setLoading(false);}@@ -891,7 +892,7 @@ const ProcessesTab = () => {loadProcesses();setSelectedProcess(null);} catch (err) {- toast.error(t('app.terminal.failed', 'Failed: {{message}}', { message: err.message }));+ toast.error(t('app.terminal.failed', 'Failed: {{message}}', { message: errorReason(err) }));}}diff --git a/frontend/src/pages/TestSandbox.jsx b/frontend/src/pages/TestSandbox.jsxindex ac26a25a..bd13cecd 100644--- a/frontend/src/pages/TestSandbox.jsx+++ b/frontend/src/pages/TestSandbox.jsx@@ -13,6 +13,7 @@ import {FlaskConical, Play, Square, ChevronDown, ChevronRight,Zap, Package, AlertTriangle, RefreshCw,} from 'lucide-react';+import { toastError } from '@/utils/errorMessage';const POLL_MS = 2500;const HISTORY_LIMIT = 20;@@ -162,12 +163,12 @@ const TestSandbox = () => {setRuns(list);return list;} catch (err) {- toast.error(err.message);+ toastError(toast, t('app.testSandbox.couldntLoadRuns', "Couldn't load runs."), err);return [];} finally {setRunsLoading(false);}- }, [toast]);+ }, [t, toast]);useEffect(() => {(async () => {@@ -199,11 +200,11 @@ const TestSandbox = () => {`Run finished: ${passed}/${total} passed${failed ? ` (${failed} failed)` : ''}`);} else if (res.run.status === 'error') {- toast.error(res.run.error || t('app.testSandbox.runFailed', 'Run failed'));+ toastError(toast, t('app.testSandbox.runFailed', 'Run failed'), res.run.error);}loadRuns();} catch (err) {- toast.error(err.message);+ toastError(toast, t('app.testSandbox.couldntRefreshRun', "Couldn't refresh the run."), err);}}, POLL_MS, {enabled: activeRun?.status === 'running',@@ -300,7 +301,7 @@ const TestSandbox = () => {toast.success(t('app.testSandbox.startedRunAcrossDistroS', 'Started {{mode}} run across {{length}} distro(s)', { mode: mode, length: res.run.distros.length }));loadRuns();} catch (err) {- toast.error(err.message);+ toastError(toast, t('app.testSandbox.couldntStart', "Couldn't start the run."), err);} finally {setStarting(false);}@@ -316,7 +317,7 @@ const TestSandbox = () => {setActiveRun(res.run);loadRuns();} catch (err) {- toast.error(err.message);+ toastError(toast, t('app.testSandbox.couldntCancel', "Couldn't cancel the run."), err);} finally {setCancelling(false);}@@ -335,7 +336,7 @@ const TestSandbox = () => {const res = await api.getTestSandboxRun(run.id);setExpandedRuns((prev) => ({ ...prev, [run.id]: res.run }));} catch (err) {- toast.error(err.message);+ toastError(toast, t('app.testSandbox.couldntLoadRun', "Couldn't load the run."), err);}};diff --git a/frontend/src/pages/Vaults.jsx b/frontend/src/pages/Vaults.jsxindex 2cf8a731..c77a4ec8 100644--- a/frontend/src/pages/Vaults.jsx+++ b/frontend/src/pages/Vaults.jsx@@ -17,6 +17,7 @@ import { useConfirm } from '@/hooks/useConfirm';import { CopyButton } from '../components/CopyButton';import { useWorkspace } from '../contexts/useWorkspace.js';import { useTranslation } from 'react-i18next';+import { errorReason } from '@/utils/errorMessage';const formatDate = (d) => (d ? new Date(d).toLocaleString() : '—');@@ -96,7 +97,7 @@ export default function Vaults() {loadAll();toast.success(t('app.vaults.vaultCreated', 'Vault created'));} catch (err) {- toast.error(t('app.vaults.failedToCreateVault', 'Failed to create vault: {{message}}', { message: err.message }));+ toast.error(t('app.vaults.failedToCreateVault', 'Failed to create vault: {{message}}', { message: errorReason(err) }));}}@@ -112,7 +113,7 @@ export default function Vaults() {loadAll();toast.success(t('app.vaults.vaultDeleted', 'Vault deleted'));} catch (err) {- toast.error(t('app.vaults.failedToDeleteVault', 'Failed to delete vault: {{message}}', { message: err.message }));+ toast.error(t('app.vaults.failedToDeleteVault', 'Failed to delete vault: {{message}}', { message: errorReason(err) }));}}@@ -128,7 +129,7 @@ export default function Vaults() {openVault(selectedVault.id);toast.success(t('app.vaults.secretCreated', 'Secret created'));} catch (err) {- toast.error(t('app.vaults.failedToCreateSecret', 'Failed to create secret: {{message}}', { message: err.message }));+ toast.error(t('app.vaults.failedToCreateSecret', 'Failed to create secret: {{message}}', { message: errorReason(err) }));}}@@ -138,7 +139,7 @@ export default function Vaults() {const { secrets } = await api.listSecrets(id);setSelectedVault({ ...vault, secrets });} catch (err) {- toast.error(t('app.vaults.failedToLoadVault', 'Failed to load vault: {{message}}', { message: err.message }));+ toast.error(t('app.vaults.failedToLoadVault', 'Failed to load vault: {{message}}', { message: errorReason(err) }));}}@@ -148,7 +149,7 @@ export default function Vaults() {setRevealSecretId(secret.id);setRevealedValue(data.value || '');} catch (err) {- toast.error(t('app.vaults.revealFailed', 'Reveal failed: {{message}}', { message: err.message }));+ toast.error(t('app.vaults.revealFailed', 'Reveal failed: {{message}}', { message: errorReason(err) }));}}@@ -163,7 +164,7 @@ export default function Vaults() {openVault(selectedVault.id);toast.success(t('app.vaults.secretDeleted', 'Secret deleted'));} catch (err) {- toast.error(t('app.vaults.failedToDeleteSecret', 'Failed to delete secret: {{message}}', { message: err.message }));+ toast.error(t('app.vaults.failedToDeleteSecret', 'Failed to delete secret: {{message}}', { message: errorReason(err) }));}}diff --git a/frontend/src/pages/WorkspaceDetail.jsx b/frontend/src/pages/WorkspaceDetail.jsxindex b5fd5a4a..e6327912 100644--- a/frontend/src/pages/WorkspaceDetail.jsx+++ b/frontend/src/pages/WorkspaceDetail.jsx@@ -28,6 +28,7 @@ import WorkspaceMembersTab from '../components/workspaces/WorkspaceMembersTab';import WorkspaceSettingsTab from '../components/workspaces/WorkspaceSettingsTab';import { useWorkspace } from '../contexts/useWorkspace.js';import { useTranslation } from 'react-i18next';+import { toastError } from '@/utils/errorMessage';const VALID_TABS = ['overview', 'servers', 'services', 'sites', 'members', 'settings'];@@ -128,7 +129,7 @@ const WorkspaceDetail = () => {await api.archiveWorkspace(wsId);toast.success(t('app.workspaceDetail.workspaceArchived', 'Workspace archived'));load();- } catch (err) { toast.error(err.message); }+ } catch (err) { toastError(toast, t('app.workspaceDetail.couldntArchive', "Couldn't archive the workspace."), err); }};const handleRestore = async () => {@@ -136,7 +137,7 @@ const WorkspaceDetail = () => {await api.restoreWorkspace(wsId);toast.success(t('app.workspaceDetail.workspaceRestored', 'Workspace restored'));load();- } catch (err) { toast.error(err.message); }+ } catch (err) { toastError(toast, t('app.workspaceDetail.couldntRestore', "Couldn't restore the workspace."), err); }};const handleDelete = async () => {@@ -145,7 +146,7 @@ const WorkspaceDetail = () => {if (isCurrent) clearActiveWorkspace();toast.success(t('app.workspaceDetail.workspaceDeleted', 'Workspace deleted'));navigate('/workspaces');- } catch (err) { toast.error(err.message); }+ } catch (err) { toastError(toast, t('app.workspaceDetail.couldntDelete', "Couldn't delete the workspace."), err); }};const handleAddMember = async (userId) => {@@ -153,7 +154,7 @@ const WorkspaceDetail = () => {await api.addWorkspaceMember(wsId, userId);toast.success(t('app.workspaceDetail.memberAdded', 'Member added'));load();- } catch (err) { toast.error(err.message); }+ } catch (err) { toastError(toast, t('app.workspaceDetail.couldntAddMember', "Couldn't add the member."), err); }};const handleRemoveMember = async (memberId) => {@@ -161,7 +162,7 @@ const WorkspaceDetail = () => {await api.removeWorkspaceMember(memberId);toast.success(t('app.workspaceDetail.memberRemoved', 'Member removed'));load();- } catch (err) { toast.error(err.message); }+ } catch (err) { toastError(toast, t('app.workspaceDetail.couldntRemoveMember', "Couldn't remove the member."), err); }};const handleMoveApp = async (appId, workspaceId) => {@@ -170,7 +171,7 @@ const WorkspaceDetail = () => {toast.success(workspaceId ? t('app.workspaceDetail.applicationMovedIn', 'Service moved in') : t('app.workspaceDetail.applicationRemoved', 'Service removed'));const data = await api.getApps({ allWorkspaces: true });setApps(data.apps || []);- } catch (err) { toast.error(err.message); }+ } catch (err) { toastError(toast, t('app.workspaceDetail.couldntMoveService', "Couldn't move the service."), err); }};const handleMoveServer = async (serverId, workspaceId) => {@@ -178,7 +179,7 @@ const WorkspaceDetail = () => {await api.setServerWorkspace(serverId, workspaceId);toast.success(workspaceId ? t('app.workspaceDetail.serverMovedIn', 'Server moved in') : t('app.workspaceDetail.serverRemoved', 'Server removed'));setServers(asServerList(await api.getServers({ allWorkspaces: true })));- } catch (err) { toast.error(err.message); }+ } catch (err) { toastError(toast, t('app.workspaceDetail.couldntMoveServer', "Couldn't move the server."), err); }};const loadSharing = async (appObj) => {@@ -186,7 +187,7 @@ const WorkspaceDetail = () => {const gData = await api.getAppGrants(appObj.id);setGrants(gData.grants || []);setSharingApp(appObj);- } catch { toast.error(t('app.workspaceDetail.failedToLoadSharing', 'Failed to load sharing')); }+ } catch (err) { toastError(toast, t('app.workspaceDetail.failedToLoadSharing', 'Failed to load sharing'), err); }};const handleGrant = async (userId) => {@@ -195,7 +196,7 @@ const WorkspaceDetail = () => {toast.success(t('app.workspaceDetail.accessGranted', 'Access granted'));const gData = await api.getAppGrants(sharingApp.id);setGrants(gData.grants || []);- } catch (err) { toast.error(err.message); }+ } catch (err) { toastError(toast, t('app.workspaceDetail.couldntGrant', "Couldn't grant access."), err); }};const handleRevoke = async (grantId) => {@@ -204,7 +205,7 @@ const WorkspaceDetail = () => {toast.success(t('app.workspaceDetail.accessRevoked', 'Access revoked'));const gData = await api.getAppGrants(sharingApp.id);setGrants(gData.grants || []);- } catch (err) { toast.error(err.message); }+ } catch (err) { toastError(toast, t('app.workspaceDetail.couldntRevoke', "Couldn't revoke access."), err); }};// Pre-load states take the same shell as the loaded page.diff --git a/frontend/src/pages/Workspaces.jsx b/frontend/src/pages/Workspaces.jsxindex 4396fb37..c2ee9ca4 100644--- a/frontend/src/pages/Workspaces.jsx+++ b/frontend/src/pages/Workspaces.jsx@@ -15,6 +15,7 @@ import { useWorkspace } from '../contexts/useWorkspace.js';import { useAuth } from '../contexts/useAuth.js';import { useServerMutation, useServerQuery } from '../hooks/useServerQuery';import { useTranslation } from 'react-i18next';+import { toastError } from '@/utils/errorMessage';// Preset views. `servers` and `users` are quota CEILINGS, not usage, so there// is no column to express "near capacity" against.@@ -137,7 +138,7 @@ const Workspaces = () => {setShowCreateModal(false);setForm({ name: '', description: '', max_servers: 0, max_users: 0, primary_color: '#6d7cff' });} catch (err) {- toast.error(err.message);+ toastError(toast, t('app.workspaces.couldntCreate', "Couldn't create the workspace."), err);}};diff --git a/frontend/src/pages/new-service/useNewServiceForm.js b/frontend/src/pages/new-service/useNewServiceForm.jsindex f7e37e93..76b028b8 100644--- a/frontend/src/pages/new-service/useNewServiceForm.js+++ b/frontend/src/pages/new-service/useNewServiceForm.js@@ -3,6 +3,7 @@ import { useTranslation } from 'react-i18next';import { useNavigate, useSearchParams } from 'react-router-dom';import api from '../../services/api';import { useToast } from '../../contexts/useToast.js';+import { toastError } from '@/utils/errorMessage';export const APP_TYPE_OPTIONS = [{ value: 'auto', labelKey: 'app.useNewServiceForm.autoDetect', label: 'Auto-detect' },@@ -162,7 +163,7 @@ export function useNewServiceForm() {const data = await api.getGithubSourceStatus();setGithubStatus(data);} catch (err) {- toast.error(err.message || t('app.useNewServiceForm.failedToLoadGithubConnection', 'Failed to load GitHub connection'));+ toastError(toast, t('app.useNewServiceForm.failedToLoadGithubConnection', 'Failed to load GitHub connection'), err);}}, [t, toast]);@@ -172,7 +173,7 @@ export function useNewServiceForm() {const data = await api.listGithubRepositories({ search, perPage: 80 });setRepos(data.repos || []);} catch (err) {- toast.error(err.message || t('app.useNewServiceForm.failedToLoadGithubRepositories', 'Failed to load GitHub repositories'));+ toastError(toast, t('app.useNewServiceForm.failedToLoadGithubRepositories', 'Failed to load GitHub repositories'), err);} finally {setReposLoading(false);}@@ -185,7 +186,7 @@ export function useNewServiceForm() {setBranches(data.branches || []);} catch (err) {setBranches([]);- toast.error(err.message || t('app.useNewServiceForm.failedToLoadBranches', 'Failed to load branches'));+ toastError(toast, t('app.useNewServiceForm.failedToLoadBranches', 'Failed to load branches'), err);} finally {setBranchesLoading(false);}@@ -266,7 +267,7 @@ export function useNewServiceForm() {.catch((err) => {if (!cancelled) {setRepoManifest(null);- toast.error(err.message || t('app.useNewServiceForm.failedToInspectManifests', 'Failed to inspect repository manifests'));+ toastError(toast, t('app.useNewServiceForm.failedToInspectManifests', 'Failed to inspect repository manifests'), err);}}).finally(() => { if (!cancelled) setRepoManifestLoading(false); });@@ -315,7 +316,7 @@ export function useNewServiceForm() {const { auth_url } = await api.startSourceConnection('github', redirectUri);window.location.href = auth_url;} catch (err) {- toast.error(err.message || t('app.useNewServiceForm.failedToStartGithubConnection', 'Failed to start GitHub connection'));+ toastError(toast, t('app.useNewServiceForm.failedToStartGithubConnection', 'Failed to start GitHub connection'), err);}}@@ -465,7 +466,7 @@ export function useNewServiceForm() {}}} catch (err) {- toast.error(err.message || t('app.useNewServiceForm.failedToCreateService', 'Failed to create service'));+ toastError(toast, t('app.useNewServiceForm.failedToCreateService', 'Failed to create service'), err);} finally {setSubmitting(false);}diff --git a/frontend/src/utils/__tests__/errorMessage.test.mjs b/frontend/src/utils/__tests__/errorMessage.test.mjsnew file mode 100644index 00000000..93f0533a--- /dev/null+++ b/frontend/src/utils/__tests__/errorMessage.test.mjs@@ -0,0 +1,58 @@+import assert from 'node:assert/strict';+import test from 'node:test';+import i18next from 'i18next';+import { errorReason, errorText, toastError } from '../errorMessage.js';++// Uninitialised i18next returns undefined; the app initialises it in i18n/index.js.+await i18next.init({ lng: 'en', resources: {} });++function apiError(status, data, message) {+ const err = new Error(message ?? data.error ?? `Request failed (${status}): /api/v1/x`);+ err.status = status;+ err.code = data.code || null;+ err.data = data;+ return err;+}++test('the server reason wins over the generic transport message', () => {+ const err = apiError(409, { error: 'Domain is attached to a service' });+ assert.equal(errorReason(err), 'Domain is attached to a service');+});++test('data.message is used when data.error is absent', () => {+ const err = new Error('Request failed (400): /api/v1/x');+ err.data = { message: 'Port 80 is taken' };+ assert.equal(errorReason(err), 'Port 80 is taken');+});++test('a translated code beats the server English', () => {+ const err = apiError(401, { error: 'Invalid username/email or password', code: 'auth.x' }, 'Contraseña incorrecta');+ assert.equal(errorReason(err), 'Contraseña incorrecta');+});++test('a bare request failure becomes a next step', () => {+ const err = apiError(500, {});+ assert.match(errorReason(err), /server logs/);+ assert.match(errorReason(new TypeError('Failed to fetch')), /didn't respond/);+});++test('result objects and strings carry their reason', () => {+ assert.equal(errorReason({ success: false, error: 'Disk full' }), 'Disk full');+ assert.equal(errorReason('Disk full'), 'Disk full');+ assert.equal(errorReason(null), '');+ assert.equal(errorReason(undefined), '');+});++test('errorText joins what failed and why with sentence stops', () => {+ const err = apiError(400, { error: 'Name is required' });+ assert.equal(errorText("Couldn't save the service.", err), "Couldn't save the service. Name is required.");+ assert.equal(errorText("Couldn't save the service.", null), "Couldn't save the service.");+ assert.equal(errorText("Couldn't save. Name is required.", err), "Couldn't save. Name is required.");+});++test('toastError hands the joined text and options to toast.error', () => {+ const calls = [];+ toastError({ error: (...args) => calls.push(args) }, "Couldn't delete the domain.",+ apiError(404, { error: 'Domain not found' }), { duration: 5000 });+ assert.deepEqual(calls, [["Couldn't delete the domain. Domain not found.", { duration: 5000 }]]);+});diff --git a/frontend/src/utils/__tests__/runRecipe.test.mjs b/frontend/src/utils/__tests__/runRecipe.test.mjsindex 835cd873..d1b55b68 100644--- a/frontend/src/utils/__tests__/runRecipe.test.mjs+++ b/frontend/src/utils/__tests__/runRecipe.test.mjs@@ -20,13 +20,16 @@ test('recipe start awaits the shared mutation contract before returning its job'assert.deepEqual(messages, ['Recipe started on Local']);});-test('failed recipe starts return no navigation target and report one error', async () => {+test('failed recipe starts return no navigation target and report what failed and why', async () => {const messages = [];+ let failed = '';const job = await runRecipe({startRun: { mutate: async () => { throw new Error('Server is offline'); } },toast: { success: assert.fail, error: (message) => messages.push(message) },- t: (_key, fallback) => fallback,+ t: (_key, fallback) => { failed = fallback; return fallback; },}, {}, { serverName: 'Local' });assert.equal(job, null);- assert.deepEqual(messages, ['Server is offline']);+ assert.equal(messages.length, 1);+ assert.ok(messages[0].startsWith(failed.replace(/\.$/, '')), messages[0]);+ assert.ok(messages[0].endsWith(' Server is offline.'), messages[0]);});diff --git a/frontend/src/utils/errorMessage.js b/frontend/src/utils/errorMessage.jsnew file mode 100644index 00000000..22764093--- /dev/null+++ b/frontend/src/utils/errorMessage.js@@ -0,0 +1,133 @@+import { t } from '../i18n/t.js';++/**+ * One door for error copy: "what failed" + "why" (+ "what to do").+ *+ * toastError(toast, t('app.domains.deleteFailed', "Couldn't delete the domain."), err);+ * // -> "Couldn't delete the domain. Domain is still attached to a service."+ *+ * The call site owns the first half (what failed, in the user's language);+ * the server owns the second (why). Before this, ~65 catch sites showed only+ * the first half and ~200 showed only the second (`err.message || t(...)`),+ * so a toast either said "Couldn't save" with no reason or "Not found" with no+ * subject.+ *+ * `errorReason` reads the reason from whatever the caller caught:+ *+ * - an ApiClient error (services/api/client.js) — `err.message` is already+ * translated when the server sent a known `code`, so it wins then;+ * otherwise `err.data.error`, `err.data.message`, `err.message`;+ * - a `{ success: false, error }` result object some services return;+ * - a bare string.+ *+ * Generic transport text ("Request failed (500): /api/…", "Failed to fetch",+ * "Network Error") is dropped when a better source exists, and otherwise+ * replaced with a sentence that says what to do next.+ */++const NETWORK_ERROR = /^(failed to fetch|network ?error|networkerror when attempting to fetch resource\.?|load failed|the network connection was lost\.?)$/i;+const REQUEST_FAILED = /^Request failed \((\d{3})\)/;++function clean(value) {+ if (typeof value !== 'string') return '';+ return value.trim();+}++function isGeneric(text) {+ return NETWORK_ERROR.test(text) || REQUEST_FAILED.test(text);+}++/** A next step for a reason that names only the transport failure. */+function genericReason(text, status) {+ if (NETWORK_ERROR.test(text)) {+ return t('common.error.network',+ "The panel server didn't respond. Check your connection and that the server is running.");+ }+ const code = Number(status) || Number(REQUEST_FAILED.exec(text)?.[1]) || 0;+ if (code === 401) return t('common.error.unauthorized', 'Your session ended. Sign in again.');+ if (code === 403) return t('common.error.forbidden', "You don't have permission to do this.");+ if (code === 404) return t('common.error.notFound', "It doesn't exist anymore. Refresh the page.");+ if (code === 408 || code === 504) {+ return t('common.error.timeout', 'The server took too long to answer. Try again.');+ }+ if (code >= 500) {+ return t('common.error.server', 'The server hit an error. Try again, or check the server logs.');+ }+ return text;+}++/**+ * The server's reason for a failure, as one display string ('' if none).+ *+ * @param {unknown} err an Error from the API client, a result object, or a string+ * @returns {string}+ */+export function errorReason(err) {+ if (err == null) return '';+ if (typeof err === 'string') {+ const text = clean(err);+ return isGeneric(text) ? genericReason(text) : text;+ }+ if (typeof err !== 'object') return '';++ const data = err.data && typeof err.data === 'object' ? err.data : null;+ const responseData = err.response?.data && typeof err.response.data === 'object'+ ? err.response.data : null;+ const message = clean(err.message);++ const candidates = [+ // A translated `code` beats the server's English (client.js sets+ // err.message from translateServerError).+ err.code && message && data && message !== clean(data.error) ? message : '',+ clean(data?.error),+ clean(data?.message),+ clean(responseData?.error),+ clean(responseData?.message),+ typeof err.error === 'string' ? clean(err.error) : '',+ message,+ ].filter(Boolean);++ const specific = candidates.find((text) => !isGeneric(text));+ if (specific) return specific;+ if (candidates.length) return genericReason(candidates[0], err.status ?? err.response?.status);+ if (err.status) return genericReason('', err.status);+ return '';+}++function withStop(text) {+ return /[.!?…:)]$/.test(text) ? text : `${text}.`;+}++/**+ * "What failed" + "why" as one sentence pair.+ *+ * @param {string} message what failed, e.g. "Couldn't delete the domain."+ * @param {unknown} err whatever was caught (see errorReason)+ * @returns {string}+ */+export function errorText(message, err) {+ const head = clean(message);+ const reason = errorReason(err);+ if (!reason) return head;+ if (!head) return withStop(reason);+ // A caller that already folded the reason into its own message.+ if (head.includes(reason)) return head;+ return `${withStop(head)} ${withStop(reason)}`;+}++/**+ * Toast a failure with its reason.+ *+ * @param {{ error: Function } | Function} toast the useToast() value, or its+ * `error` method (pages that keep `toast.error` in a stable const for+ * hook dependency lists)+ * @param {string} message what failed, e.g. "Couldn't delete the domain."+ * @param {unknown} err whatever was caught+ * @param {object|number} [opts] passed through to toast.error+ */+export function toastError(toast, message, err, opts) {+ const show = typeof toast === 'function' ? toast : toast.error;+ return show(errorText(message, err), opts);+}++export default errorReason;diff --git a/frontend/src/utils/runRecipe.js b/frontend/src/utils/runRecipe.jsindex 19fe2d01..b28604ae 100644--- a/frontend/src/utils/runRecipe.js+++ b/frontend/src/utils/runRecipe.js@@ -1,3 +1,4 @@+import { toastError } from './errorMessage.js';// useServerMutation exposes an async `mutate`; recipe navigation waits for its// job ID, while this adapter owns the catalog's success/failure messages.export async function runRecipe({ startRun, toast, t }, body, { serverName }) {@@ -8,7 +9,7 @@ export async function runRecipe({ startRun, toast, t }, body, { serverName }) {}));return result.job_id;} catch (err) {- toast.error(err.message || t('app.recipes.startFailed', 'Could not start the recipe'));+ toastError(toast, t('app.recipes.startFailed', 'Could not start the recipe'), err);return null;}}