@@ -12,7 +12,7 @@ if (typeof LIVE_RELOAD !== "undefined" && LIVE_RELOAD) {
12
12
import { dictionary } from "../dictionary/dictionary.ts" ;
13
13
import { asComment } from "../dictionary/misc.ts" ;
14
14
import PROJECT_DATA from "../project_data.json" with { type : "json" } ;
15
- import { ArrayResultError } from "./array_result.ts" ;
15
+ import { ArrayResultError , isArrayResult } from "./array_result.ts" ;
16
16
import { loadCustomDictionary } from "./dictionary.ts" ;
17
17
import { checkLocalStorage , setIgnoreError } from "./local_storage.ts" ;
18
18
import { flattenError } from "../misc/misc.ts" ;
@@ -144,7 +144,7 @@ function main(): void {
144
144
try {
145
145
loadCustomDictionary ( customDictionary ) ;
146
146
} catch ( error ) {
147
- errorDisplay . innerText = errorsFixable ( flattenError ( error ) )
147
+ errorDisplay . innerText = isArrayResult ( flattenError ( error ) )
148
148
? DICTIONARY_LOADING_FAILED_FIXABLE_MESSAGE
149
149
: DICTIONARY_LOADING_FAILED_UNFIXABLE_MESSAGE ;
150
150
// deno-lint-ignore no-console
@@ -276,7 +276,7 @@ function main(): void {
276
276
customDictionaryDialogBox . close ( ) ;
277
277
} catch ( error ) {
278
278
const errors = flattenError ( error ) ;
279
- const message = errorsFixable ( errors )
279
+ const message = isArrayResult ( errors )
280
280
? DICTIONARY_ERROR_FIXABLE_MESSAGE
281
281
: DICTIONARY_ERROR_UNFIXABLE_MESSAGE ;
282
282
const errorListMessage = errors
@@ -300,10 +300,6 @@ function extractErrorMessage(error: unknown): string {
300
300
return `${ error } ` ;
301
301
}
302
302
}
303
- function errorsFixable ( errors : ReadonlyArray < unknown > ) : boolean {
304
- return errors . length > 0 &&
305
- errors . every ( ( error ) => error instanceof ArrayResultError ) ;
306
- }
307
303
308
304
if ( document . readyState === "loading" ) {
309
305
document . addEventListener ( "DOMContentLoaded" , main ) ;
0 commit comments