Closed jonaslund closed 4 years ago
Solution. Put a catch error block in the request() function, like so
request() {
const { from, requestOpts } = this.opts;
return new Promise(resolve => {
if (from !== Auto) {
resolve()
} else {
this.langdetect().then(lan => {
this.opts.from = lan;
resolve();
});
}
}).then(() => {
return cookie.get(requestOpts).then(() => this.trans());
}).catch((err) => {
return "error";
});
}
How to do proper error handling?
Running it with no Internet, which may happen in various installations, should happen cleanly and with proper error reporting, currently it results in a unhandled promise rejection,
Thanks