Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@action async fetch(errorCallback: () => void) {
this.isLoading = true;
try {
const { matches, messages } = await FetchService.updates(); // eslint-disable-line
if (matches.length || messages.length) {
this.getFromDb();
}
this.isLoading = false;
} catch (err) {
LogRocket.error('fetch', err);
if (err && window.Bugsnag) {
Bugsnag.notifyException(err);
}
if (err.type) {
if (window.Bugsnag) {
Bugsnag.notifyException(new Error('dbError'), 'fetch()', { type: err.type, data: err.data, size: err.size });
}
if (window.hj) {
window.hj('tagRecording', ['With error']);
}
} else if (typeof errorCallback === 'function') errorCallback();
this.isLoading = false;
}