Merge pull request #1781 from evhan55/extensions/rpc-error

Adding check for open request before calling RPC reject/resolve.
This commit is contained in:
Evelyn Eastmond 2018-11-27 12:06:10 -08:00 committed by GitHub
commit acc2e6dba2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -86,12 +86,14 @@ class JSONRPC {
const {result, error, id} = json; const {result, error, id} = json;
const openRequest = this._openRequests[id]; const openRequest = this._openRequests[id];
delete this._openRequests[id]; delete this._openRequests[id];
if (openRequest) {
if (error) { if (error) {
openRequest.reject(error); openRequest.reject(error);
} else { } else {
openRequest.resolve(result); openRequest.resolve(result);
} }
} }
}
_handleRequest (json) { _handleRequest (json) {
const {method, params, id} = json; const {method, params, id} = json;