fix(browser): restore res.json before error handling in withRouteTabContext
The intercepted res.json was not restored on exceptions from run(), causing handleRouteError -> jsonError to hit the buffer interceptor instead of actually sending the error response. This could leave HTTP requests hanging on any Playwright failure in tab-targeting routes. Addresses codex-connector P1 on PR #30323.
This commit is contained in:
parent
52f4f9c6b4
commit
9dddc5e517
@ -133,11 +133,18 @@ export async function withRouteTabContext<T>(
|
||||
return params.res;
|
||||
};
|
||||
|
||||
const result = await params.run({
|
||||
profileCtx,
|
||||
tab,
|
||||
cdpUrl: profileCtx.profile.cdpUrl,
|
||||
});
|
||||
let result: T | undefined;
|
||||
try {
|
||||
result = await params.run({
|
||||
profileCtx,
|
||||
tab,
|
||||
cdpUrl: profileCtx.profile.cdpUrl,
|
||||
});
|
||||
} catch (runErr) {
|
||||
// Restore original res.json so error handling can actually send.
|
||||
params.res.json = originalJson;
|
||||
throw runErr;
|
||||
}
|
||||
|
||||
// Now enrich and flush the intercepted response body.
|
||||
if (jsonCalled) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user