Skip to content

Commit 0427184

Browse files
committed
Send 500 responses for real interceptor activation errors
Shouldn't affect the UI significantly AFAICT but this does make it easier to debug these particularly when scanning through the network traffic (and of course, it's just the right RESTy thing to do)
1 parent 547729e commit 0427184

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/api/api-model.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ export class ApiModel {
199199
code: activationError.code,
200200
message: activationError.message
201201
}
202-
: {}
202+
: false
203203
};
204204
}
205205
}

src/api/rest-api.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,13 @@ export function exposeRestAPI(
7373

7474
const interceptorOptions = req.body;
7575
const result = await apiModel.activateInterceptor(interceptorId, proxyPort, interceptorOptions);
76-
res.send({ result });
76+
77+
if (result.success === true || result.error === false) {
78+
// Some non-success is just temporary, e.g. global Chrome "exit running app please" confirmation.
79+
res.json({ result });
80+
} else {
81+
res.status(500).json({ result });
82+
}
7783
}));
7884

7985
server.post('/client/send', handleErrors(async (req, res) => {

0 commit comments

Comments
 (0)