diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2019-12-08 15:52:34 -0500 |
---|---|---|
committer | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2019-12-08 16:01:29 -0500 |
commit | 2dad7f888b77c7c0293512076b719026f6b95de9 (patch) | |
tree | bfa67f43cebaee618e6f3c4f178db69e53a6dd05 /ext/bg/js/database.js | |
parent | 0156869a3d8c4236594035e072b084b7c2ea8f16 (diff) |
Update how errors are reported when importing a dictionary
Diffstat (limited to 'ext/bg/js/database.js')
-rw-r--r-- | ext/bg/js/database.js | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/ext/bg/js/database.js b/ext/bg/js/database.js index 2f624189..5aee2311 100644 --- a/ext/bg/js/database.js +++ b/ext/bg/js/database.js @@ -332,9 +332,10 @@ class Database { return result; } - async importDictionary(archive, progressCallback, exceptions, details) { + async importDictionary(archive, progressCallback, details) { this.validate(); + const errors = []; const prefixWildcardsSupported = details.prefixWildcardsSupported; const maxTransactionLength = 1000; @@ -351,11 +352,7 @@ class Database { const objectStore = transaction.objectStore(objectStoreName); await Database.bulkAdd(objectStore, items, i, count); } catch (e) { - if (exceptions) { - exceptions.push(e); - } else { - throw e; - } + errors.push(e); } } }; @@ -496,7 +493,7 @@ class Database { await bulkAdd('tagMeta', rows, total, current); }; - return await Database.importDictionaryZip( + const result = await Database.importDictionaryZip( archive, indexDataLoaded, termDataLoaded, @@ -506,6 +503,8 @@ class Database { tagDataLoaded, details ); + + return {result, errors}; } validate() { |