mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-14 04:39:23 +00:00
change(web): apply focused try-catch suggestion from review
Co-authored-by: Marc Durdin <marc@durdin.net>
This commit is contained in:
parent
a5c987116b
commit
accdb3752e
1 changed files with 8 additions and 2 deletions
|
|
@ -42,10 +42,16 @@ export class LanguageProcessor extends EventEmitter<LanguageProcessorEventMap> {
|
|||
return;
|
||||
}
|
||||
|
||||
let instance: <TypeHere>;
|
||||
try {
|
||||
this.lmEngine = new LMLayer(capabilities, predictiveWorkerFactory?.constructInstance());
|
||||
} catch {
|
||||
instance = predictiveWorkerFactory?.constructInstance();
|
||||
} catch(e) {
|
||||
// We can condition on `lmEngine` being null/undefined.
|
||||
console.warn('Web workers are not available: ' + (e ?? '').toString());
|
||||
instance = null;
|
||||
}
|
||||
if(instance) {
|
||||
this.lmEngine = new LMLayer(capabilities, instance);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue