Merge pull request #434 from toasted-nutbread/error-fixes

Error fixes
This commit is contained in:
toasted-nutbread 2020-04-07 19:28:07 -04:00 committed by GitHub
commit f177e3699a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 6 deletions

View File

@ -99,7 +99,7 @@ class Database {
}); });
return true; return true;
} catch (e) { } catch (e) {
console.error(e); logError(e);
return false; return false;
} }
} }

View File

@ -174,7 +174,7 @@ class DictionaryImporter {
try { try {
await database.bulkAdd(objectStoreName, entries, i, count); await database.bulkAdd(objectStoreName, entries, i, count);
} catch (e) { } catch (e) {
errors.push(e); errors.push(errorToJson(e));
} }
loadedCount += count; loadedCount += count;

View File

@ -555,7 +555,7 @@ function dictionaryErrorsShow(errors) {
if (errors !== null && errors.length > 0) { if (errors !== null && errors.length > 0) {
const uniqueErrors = new Map(); const uniqueErrors = new Map();
for (let e of errors) { for (let e of errors) {
console.error(e); logError(e);
e = dictionaryErrorToString(e); e = dictionaryErrorToString(e);
let count = uniqueErrors.get(e); let count = uniqueErrors.get(e);
if (typeof count === 'undefined') { if (typeof count === 'undefined') {
@ -693,9 +693,9 @@ async function onDictionaryImport(e) {
await settingsSaveOptions(); await settingsSaveOptions();
if (errors.length > 0) { if (errors.length > 0) {
errors.push(...errors); const errors2 = errors.map((error) => jsonToError(error));
errors.push(`Dictionary may not have been imported properly: ${errors.length} error${errors.length === 1 ? '' : 's'} reported.`); errors2.push(`Dictionary may not have been imported properly: ${errors2.length} error${errors2.length === 1 ? '' : 's'} reported.`);
dictionaryErrorsShow(errors); dictionaryErrorsShow(errors2);
} }
onDatabaseUpdated(); onDatabaseUpdated();