From e881e302b69025c7d916381679dc1578923c3fc3 Mon Sep 17 00:00:00 2001 From: hsiegeln <37154749+hsiegeln@users.noreply.github.com> Date: Sun, 26 Apr 2026 21:28:53 +0200 Subject: [PATCH] fix(ui): check ApiError.status instead of message string for 404 detection MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The ApiError class (088bc34) extracts messages from response bodies, so a 404 with no body produces "Request failed" — not "404". The email connector hook's string check failed, treating "not configured" as an error and showing "Failed to load config" on fresh installs. Co-Authored-By: Claude Opus 4.6 (1M context) --- ui/src/api/email-connector-hooks.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/src/api/email-connector-hooks.ts b/ui/src/api/email-connector-hooks.ts index 8417e05..1c6acf6 100644 --- a/ui/src/api/email-connector-hooks.ts +++ b/ui/src/api/email-connector-hooks.ts @@ -1,5 +1,5 @@ import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'; -import { api } from './client'; +import { api, ApiError } from './client'; export interface EmailConnectorResponse { connectorId: string; @@ -32,7 +32,7 @@ export function useEmailConnector() { try { return await api.get('/vendor/email-connector'); } catch (e) { - if (e instanceof Error && e.message.includes('404')) return null; + if (e instanceof ApiError && e.status === 404) return null; throw e; } },