You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
🤖 fix: Prevent unhandled promise rejection in web force delete (#389)
## Problem
When using force delete in web/server mode, an unhandled promise
rejection occurs, causing the error to be logged but not properly
handled in the UI.
**Root Cause:** The browser API client's `invokeIPC` function throws
errors for string error messages, while Electron's
`ipcRenderer.invoke()` returns error objects. This inconsistency meant
that force delete errors in web mode were thrown as exceptions instead
of being returned as `{ success: false, error: '...' }`.
## Solution
1. **Fixed browser API error handling**: Modified `src/browser/api.ts`
to return error objects instead of throwing, matching Electron's
behavior
2. **Added defensive error handling**: Wrapped `removeWorkspace` and
`renameWorkspace` in try-catch blocks for extra safety against
network/parsing errors
3. **Added comprehensive tests**: Created `src/browser/api.test.ts` to
verify error handling behavior and prevent regressions
## Testing
- Added unit tests demonstrating the fix
- Verified type checking passes
- Confirmed existing tests still pass (3 pre-existing failures unrelated
to this change)
_Generated with `cmux`_
0 commit comments