Add a try/catch in NPM/Zombie.js driver

main
Elbert Alias 5 years ago
parent 62f881127c
commit c86cd7e7a8

@ -9794,7 +9794,7 @@
], ],
"icon": "Sencha Touch.png", "icon": "Sencha Touch.png",
"script": "sencha-touch.*\\.js", "script": "sencha-touch.*\\.js",
"website": "http://sencha.com/products/touch" "website": "http://www.sencha.com/products/touch"
}, },
"Seravo": { "Seravo": {
"cats": [ "cats": [

@ -20,7 +20,8 @@ class ZombieBrowser extends Browser {
} }
visit(url) { visit(url) {
return new Promise((resolve) => { return new Promise((resolve, reject) => {
try {
this.browser.visit(url, () => { this.browser.visit(url, () => {
const resource = this.browser.resources.length const resource = this.browser.resources.length
? this.browser.resources.filter(_resource => _resource.response).shift() : null; ? this.browser.resources.filter(_resource => _resource.response).shift() : null;
@ -38,6 +39,9 @@ class ZombieBrowser extends Browser {
resolve(); resolve();
}); });
} catch (error) {
reject(error.message);
}
}); });
} }

Loading…
Cancel
Save