Skip to content

Commit 187075e

Browse files
committed
allow words to be imported regardless of errors
1 parent 9766262 commit 187075e

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/main.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,7 @@ const DICTIONARY_LOADING_FAILED_MESSAGE =
6060
const NO_WORD_MESSAGE = "Please provide a word";
6161
const WORD_NOT_FOUND_MESSAGE = "Word not found";
6262
const WORD_ALREADY_IMPORTED_MESSAGE = "The word is already imported";
63-
const DICTIONARY_ERROR_MESSAGE_ON_IMPORT =
64-
"Please fix the errors before adding words";
65-
const DICTIONARY_ERROR_MESSAGE_ON_SAVE = "Please fix the errors before saving";
63+
const DICTIONARY_ERROR_MESSAGE = "Please fix the errors before saving";
6664

6765
function main(): void {
6866
// load elements
@@ -306,10 +304,9 @@ function main(): void {
306304
const word = importWordTextBox.value.trim();
307305
if (word === "") {
308306
showMessage(NO_WORD_MESSAGE);
309-
} else if (autoParse() && currentDictionary.isError()) {
310-
showMessage(DICTIONARY_ERROR_MESSAGE_ON_IMPORT);
311307
} else if (
312-
autoParse() && currentDictionary.unwrap()[0].has(word)
308+
autoParse() && !currentDictionary.isError() &&
309+
currentDictionary.unwrap()[0].has(word)
313310
) {
314311
showMessage(WORD_ALREADY_IMPORTED_MESSAGE);
315312
} else {
@@ -358,7 +355,7 @@ function main(): void {
358355
setIgnoreError(DICTIONARY_KEY, customDictionaryTextBox.value);
359356
customDictionaryDialogBox.close();
360357
} else {
361-
showMessage(DICTIONARY_ERROR_MESSAGE_ON_SAVE);
358+
showMessage(DICTIONARY_ERROR_MESSAGE);
362359
}
363360
}
364361
closeButton.addEventListener("click", () => {

0 commit comments

Comments
 (0)