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 browser API handling of failed Results without error property (#393)
_Generated with `cmux`_
## Problem
The web main-server's `HttpIpcMainAdapter` was incorrectly handling
failed Results that don't have an `error` property.
The check required both `success === false` AND `'error' in result`:
```typescript
if (
result &&
typeof result === "object" &&
"success" in result &&
result.success === false &&
"error" in result // <-- This line was the bug
) {
res.json(result);
return;
}
res.json({ success: true, data: result });
```
When a handler returned `{ success: false }` without an `error`
property, the check failed and the result was incorrectly wrapped as:
```json
{
"success": true,
"data": { "success": false }
}
```
This broke error handling in the frontend - errors from operations like
force workspace deletion weren't being properly communicated.
## Solution
Remove the `'error' in result` requirement. Any Result with `success:
false` should be passed through directly, regardless of whether it has
an `error` property.
## Testing
Added test case in `api.test.ts` to verify Results without error
property are handled correctly.
0 commit comments