From 82ace36982ab24c4736c566490ee7eab0534f85e Mon Sep 17 00:00:00 2001 From: Christian Byrne Date: Mon, 16 Feb 2026 03:01:17 -0800 Subject: [PATCH] fix: show user-friendly message for network errors (#8748) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary Replaces cryptic "Failed to fetch" error messages with user-friendly "Disconnected from backend" messages. ## Changes - **What**: Detect network fetch errors in the central toast error handler and display a helpful message with suggested action ("Check if the server is running") ## Review Focus The fix is intentionally minimal—only the central `toastErrorHandler` is modified since all user-facing API errors flow through it. Fixes COM-1839 ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-8748-fix-show-user-friendly-message-for-network-errors-3016d73d365081b3869bf19550c9af93) by [Unito](https://www.unito.io) --- src/composables/useErrorHandling.ts | 9 ++++++++- src/locales/en/main.json | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/composables/useErrorHandling.ts b/src/composables/useErrorHandling.ts index 9dce59340c..4340fed670 100644 --- a/src/composables/useErrorHandling.ts +++ b/src/composables/useErrorHandling.ts @@ -52,10 +52,17 @@ export interface ErrorRecoveryStrategy< export function useErrorHandling() { const toast = useToastStore() const toastErrorHandler = (error: unknown) => { + const isNetworkError = + error instanceof TypeError && error.message === 'Failed to fetch' + const message = isNetworkError + ? t('g.disconnectedFromBackend') + : error instanceof Error + ? error.message + : t('g.unknownError') toast.add({ severity: 'error', summary: t('g.error'), - detail: error instanceof Error ? error.message : t('g.unknownError') + detail: message }) console.error(error) } diff --git a/src/locales/en/main.json b/src/locales/en/main.json index 66ab62d963..5544c45f72 100644 --- a/src/locales/en/main.json +++ b/src/locales/en/main.json @@ -98,6 +98,7 @@ "unknownFile": "Unknown file", "reconnecting": "Reconnecting", "reconnected": "Reconnected", + "disconnectedFromBackend": "Disconnected from backend. Check if the server is running.", "delete": "Delete", "rename": "Rename", "save": "Save",