Bladeren bron

added isIgnoredError function

Gildas 5 jaren geleden
bovenliggende
commit
47bba60a77
1 gewijzigde bestanden met toevoegingen van 7 en 1 verwijderingen
  1. 7 1
      extension/core/bg/business.js

+ 7 - 1
extension/core/bg/business.js

@@ -189,7 +189,7 @@ singlefile.extension.core.bg.business = (() => {
 				tabs.remove(taskInfo.tab.id);
 			}
 		} catch (error) {
-			if (error && (!error.message || (error.message != ERROR_CONNECTION_LOST_CHROMIUM && error.message != ERROR_CONNECTION_ERROR_CHROMIUM && error.message != ERROR_CONNECTION_LOST_GECKO))) {
+			if (error && (!error.message || !isIgnoredError(error))) {
 				console.log(error); // eslint-disable-line no-console
 				ui.onError(taskInfo.tab.id);
 				taskInfo.done();
@@ -197,6 +197,12 @@ singlefile.extension.core.bg.business = (() => {
 		}
 	}
 
+	function isIgnoredError(error) {
+		return error.message == ERROR_CONNECTION_LOST_CHROMIUM ||
+			error.message == ERROR_CONNECTION_ERROR_CHROMIUM ||
+			error.message == ERROR_CONNECTION_LOST_GECKO;
+	}
+
 	function cancelTab(tabId) {
 		Array.from(tasks).filter(taskInfo => taskInfo.tab.id == tabId && !taskInfo.options.autoSave).forEach(cancelTask);
 	}