summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-04-07 19:28:07 -0400
committerGitHub <noreply@github.com>2020-04-07 19:28:07 -0400
commitf177e3699ae85bafa3a648f5c03fbb8e303a6be3 (patch)
tree626a0c7fa4753258cf2ccbb1793cb3fdabb96500 /ext
parentac1ecb35ee010969b683188501ea473c2575f65d (diff)
parent9dfe531dfd75af0eec26d532a40095fe8a982df1 (diff)
Merge pull request #434 from toasted-nutbread/error-fixes
Error fixes
Diffstat (limited to 'ext')
-rw-r--r--ext/bg/js/database.js2
-rw-r--r--ext/bg/js/dictionary-importer.js2
-rw-r--r--ext/bg/js/settings/dictionaries.js8
3 files changed, 6 insertions, 6 deletions
diff --git a/ext/bg/js/database.js b/ext/bg/js/database.js
index 7a4d094b..4a677fea 100644
--- a/ext/bg/js/database.js
+++ b/ext/bg/js/database.js
@@ -99,7 +99,7 @@ class Database {
});
return true;
} catch (e) {
- console.error(e);
+ logError(e);
return false;
}
}
diff --git a/ext/bg/js/dictionary-importer.js b/ext/bg/js/dictionary-importer.js
index f9e173ea..254fde4f 100644
--- a/ext/bg/js/dictionary-importer.js
+++ b/ext/bg/js/dictionary-importer.js
@@ -174,7 +174,7 @@ class DictionaryImporter {
try {
await database.bulkAdd(objectStoreName, entries, i, count);
} catch (e) {
- errors.push(e);
+ errors.push(errorToJson(e));
}
loadedCount += count;
diff --git a/ext/bg/js/settings/dictionaries.js b/ext/bg/js/settings/dictionaries.js
index b9e4fe82..33ced3b9 100644
--- a/ext/bg/js/settings/dictionaries.js
+++ b/ext/bg/js/settings/dictionaries.js
@@ -555,7 +555,7 @@ function dictionaryErrorsShow(errors) {
if (errors !== null && errors.length > 0) {
const uniqueErrors = new Map();
for (let e of errors) {
- console.error(e);
+ logError(e);
e = dictionaryErrorToString(e);
let count = uniqueErrors.get(e);
if (typeof count === 'undefined') {
@@ -693,9 +693,9 @@ async function onDictionaryImport(e) {
await settingsSaveOptions();
if (errors.length > 0) {
- errors.push(...errors);
- errors.push(`Dictionary may not have been imported properly: ${errors.length} error${errors.length === 1 ? '' : 's'} reported.`);
- dictionaryErrorsShow(errors);
+ const errors2 = errors.map((error) => jsonToError(error));
+ errors2.push(`Dictionary may not have been imported properly: ${errors2.length} error${errors2.length === 1 ? '' : 's'} reported.`);
+ dictionaryErrorsShow(errors2);
}
onDatabaseUpdated();