Skip to content

Commit 3dfd745

Browse files
committed
fix propagating protocol fetch errors when using stdio pipes (the callback-based
implementation doesn't correctly transform the cdp errors)
1 parent 5623c76 commit 3dfd745

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

lib/devtools.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,9 @@ function Protocol(options, callback) {
5151
// fetch remotely via CDP when using stdio pipes (Bright Data exclusive)
5252
if (options.cdp)
5353
{
54-
return options.cdp.send('Browser.getProtocolJson', (err, data)=>{
55-
if (err)
56-
return callback(err);
57-
callback(null, JSON.parse(data.result));
58-
});
54+
return options.cdp.send('Browser.getProtocolJson')
55+
.then(data=>callback(null, JSON.parse(data.result)))
56+
.catch(callback)
5957
}
6058
// if the local protocol is requested
6159
if (options.local) {

0 commit comments

Comments
 (0)