chrome-remote-interface
Advanced tools
Comparing version 0.24.0 to 0.24.1
@@ -14,4 +14,9 @@ 'use strict'; | ||
constructor(response) { | ||
super(response.message); | ||
Object.assign(this, response); | ||
let message = response.message; | ||
if (response.data) { | ||
message += ` (${response.data})`; | ||
} | ||
super(message); | ||
// attach the original response as well | ||
this.response = response; | ||
} | ||
@@ -84,3 +89,5 @@ } | ||
if (error) { | ||
reject(new ProtocolError(response)); | ||
reject(error instanceof Error | ||
? error // low-level WebSocket error | ||
: new ProtocolError(response)); | ||
} else { | ||
@@ -119,4 +126,12 @@ fulfill(response); | ||
const message = {'id': id, 'method': method, 'params': params || {}}; | ||
chrome._ws.send(JSON.stringify(message)); | ||
chrome._callbacks[id] = callback; | ||
chrome._ws.send(JSON.stringify(message), function (err) { | ||
if (err) { | ||
// handle low-level WebSocket errors | ||
if (typeof callback === 'function') { | ||
callback(err); | ||
} | ||
} else { | ||
chrome._callbacks[id] = callback; | ||
} | ||
}); | ||
} | ||
@@ -123,0 +138,0 @@ |
@@ -12,3 +12,3 @@ { | ||
"homepage": "https://github.com/cyrus-and/chrome-remote-interface", | ||
"version": "0.24.0", | ||
"version": "0.24.1", | ||
"repository": { | ||
@@ -15,0 +15,0 @@ "type": "git", |
@@ -782,2 +782,5 @@ chrome-remote-interface [![Build Status](https://travis-ci.org/cyrus-and/chrome-remote-interface.svg?branch=master)](https://travis-ci.org/cyrus-and/chrome-remote-interface) | ||
In case of low-level WebSocket errors, the `error` parameter contains the | ||
originating `Error` object and no `response` is returned. | ||
Note that the field `id` mentioned in the [Chrome Debugging Protocol] | ||
@@ -784,0 +787,0 @@ specification is managed internally and it is not exposed to the user. |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
969560
15541
849