auto-claude: subtask-9-4 - Add comprehensive error handling for all IPC window operations

- Add window error translations to en/fr errors.json
- Add toast notifications for pop-out project errors in ProjectTabBar
- Add toast notifications for pop-out view errors in Sidebar
- Ensure loading states reset properly in finally blocks
- User-facing error messages for window creation failures
This commit is contained in:
AndyMik90
2026-02-15 17:24:52 +01:00
parent 6d3ab81136
commit 04c03f5818
4 changed files with 40 additions and 4 deletions
@@ -7,6 +7,7 @@ import { SortableProjectTab } from './SortableProjectTab';
import { UsageIndicator } from './UsageIndicator';
import { AuthStatusIndicator } from './AuthStatusIndicator';
import { useWindowStore } from '../stores/window-store';
import { useToast } from '../hooks/use-toast';
import type { Project } from '../../shared/types';
interface ProjectTabBarProps {
@@ -29,7 +30,8 @@ export function ProjectTabBar({
className,
onSettingsClick
}: ProjectTabBarProps) {
const { t } = useTranslation('common');
const { t } = useTranslation(['common', 'errors']);
const { toast } = useToast();
const { isProjectPoppedOut, setWindowLoading, addPoppedOutProject, isWindowLoading } = useWindowStore();
// Handler for popping out a project into a new window
@@ -52,7 +54,11 @@ export function ProjectTabBar({
console.log(`Project ${projectId} already popped out, focused existing window ${error.existingWindowId}`);
} else {
console.error('Failed to pop out project:', error.message);
// TODO: Show error notification to user
toast({
title: t('errors:window.popOutProjectFailed'),
description: t('errors:window.windowCreationFailed', { message: error.message }),
variant: 'destructive'
});
}
return;
}
@@ -63,7 +69,11 @@ export function ProjectTabBar({
console.log(`Project ${projectId} popped out to window ${successResult.windowId}`);
} catch (error) {
console.error('Failed to pop out project:', error);
// TODO: Show error notification to user
toast({
title: t('errors:window.popOutProjectFailed'),
description: error instanceof Error ? error.message : t('errors:window.genericError'),
variant: 'destructive'
});
} finally {
setWindowLoading(projectId, false);
}
@@ -61,6 +61,7 @@ import { GitSetupModal } from './GitSetupModal';
import { RateLimitIndicator } from './RateLimitIndicator';
import { ClaudeCodeStatusBadge } from './ClaudeCodeStatusBadge';
import { UpdateBanner } from './UpdateBanner';
import { useToast } from '../hooks/use-toast';
import type { Project, GitStatus } from '../../shared/types';
export type SidebarView = 'kanban' | 'terminals' | 'roadmap' | 'context' | 'ideation' | 'github-issues' | 'gitlab-issues' | 'github-prs' | 'gitlab-merge-requests' | 'changelog' | 'insights' | 'worktrees' | 'agent-tools';
@@ -110,7 +111,8 @@ export function Sidebar({
activeView = 'kanban',
onViewChange
}: SidebarProps) {
const { t } = useTranslation(['navigation', 'dialogs', 'common']);
const { t } = useTranslation(['navigation', 'dialogs', 'common', 'errors']);
const { toast } = useToast();
const projects = useProjectStore((state) => state.projects);
const selectedProjectId = useProjectStore((state) => state.selectedProjectId);
const settings = useSettingsStore((state) => state.settings);
@@ -321,6 +323,11 @@ export function Sidebar({
await window.electronAPI.window.focusWindow(error.existingWindowId);
} else {
console.error('Failed to pop out view:', error.message);
toast({
title: t('errors:window.popOutViewFailed'),
description: t('errors:window.windowCreationFailed', { message: error.message }),
variant: 'destructive'
});
}
return;
}
@@ -330,6 +337,11 @@ export function Sidebar({
addPoppedOutView(selectedProjectId, view, successResult.windowId);
} catch (error) {
console.error('Failed to pop out view:', error);
toast({
title: t('errors:window.popOutViewFailed'),
description: error instanceof Error ? error.message : t('errors:window.genericError'),
variant: 'destructive'
});
} finally {
setWindowLoading(viewKey, false);
}
@@ -5,5 +5,12 @@
"titleSuffix": "(JSON Error)",
"description": "⚠️ JSON Parse Error: {{error}}\n\nThe implementation_plan.json file is malformed. Run the backend auto-fix or manually repair the file."
}
},
"window": {
"popOutProjectFailed": "Failed to pop out project",
"popOutViewFailed": "Failed to pop out view",
"windowCreationFailed": "Could not create window: {{message}}",
"sourceWindowNotFound": "Source window not found",
"genericError": "An unexpected error occurred"
}
}
@@ -5,5 +5,12 @@
"titleSuffix": "(Erreur JSON)",
"description": "⚠️ Erreur d'analyse JSON : {{error}}\n\nLe fichier implementation_plan.json est malformé. Exécutez la correction automatique du backend ou réparez le fichier manuellement."
}
},
"window": {
"popOutProjectFailed": "Échec de l'extraction du projet",
"popOutViewFailed": "Échec de l'extraction de la vue",
"windowCreationFailed": "Impossible de créer la fenêtre : {{message}}",
"sourceWindowNotFound": "Fenêtre source introuvable",
"genericError": "Une erreur inattendue s'est produite"
}
}