From 3a8741b32dac60a3f7d2fcfb50a9be7ca163c80c Mon Sep 17 00:00:00 2001 From: Haileyesus Date: Mon, 23 Feb 2026 11:44:29 +0300 Subject: [PATCH] fix(git-panel): add error handling for branch switch and fetch operations --- .../git-panel/view/GitPanelHeader.tsx | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/components/git-panel/view/GitPanelHeader.tsx b/src/components/git-panel/view/GitPanelHeader.tsx index 8a2537c..739ebba 100644 --- a/src/components/git-panel/view/GitPanelHeader.tsx +++ b/src/components/git-panel/view/GitPanelHeader.tsx @@ -89,9 +89,21 @@ export default function GitPanelHeader({ }; const handleSwitchBranch = async (branchName: string) => { - const success = await onSwitchBranch(branchName); - if (success) { - setShowBranchDropdown(false); + try { + const success = await onSwitchBranch(branchName); + if (success) { + setShowBranchDropdown(false); + } + } catch (error) { + console.error('[GitPanelHeader] Failed to switch branch:', error); + } + }; + + const handleFetch = async () => { + try { + await onFetch(); + } catch (error) { + console.error('[GitPanelHeader] Failed to fetch remote changes:', error); } }; @@ -214,7 +226,7 @@ export default function GitPanelHeader({ {shouldShowFetchButton && (