Skip to content

Commit

Permalink
fixup! debugger: use ERR_DEBUGGER_ERROR in debugger client
Browse files Browse the repository at this point in the history
  • Loading branch information
aduh95 committed Jul 19, 2021
1 parent dfdbda5 commit 224c3d8
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions lib/internal/inspector/inspect_client.js
Expand Up @@ -180,7 +180,9 @@ class Client extends EventEmitter {
debuglog('< %s', payloadStr);
const lastChar = payloadStr[payloadStr.length - 1];
if (payloadStr[0] !== '{' || lastChar !== '}') {
throw new ERR_DEBUGGER_ERROR(`Payload does not look like JSON: ${payloadStr}`);
throw new ERR_DEBUGGER_ERROR(
`Payload does not look like JSON: ${payloadStr}`
);
}
let payload;
try {
Expand Down Expand Up @@ -251,14 +253,17 @@ class Client extends EventEmitter {
function parseChunks() {
const resBody = Buffer.concat(chunks).toString();
if (httpRes.statusCode !== 200) {
reject(new ERR_DEBUGGER_ERROR(`Unexpected ${httpRes.statusCode}: ${resBody}`));
reject(new ERR_DEBUGGER_ERROR(
`Unexpected ${httpRes.statusCode}: ${resBody}`
));
return;
}
try {
resolve(JSONParse(resBody));
} catch {
reject(new ERR_DEBUGGER_ERROR(`Response didn't contain JSON: ${resBody}`));

reject(new ERR_DEBUGGER_ERROR(
`Response didn't contain JSON: ${resBody}`
));
}
}

Expand Down

0 comments on commit 224c3d8

Please sign in to comment.