Skip to content

Commit

Permalink
References #50 Added error handling for errors occurring during startup
Browse files Browse the repository at this point in the history
  • Loading branch information
falcon71 committed Feb 21, 2025
1 parent 40bfbec commit b4a4ff2
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions kln90b/KLN90B.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
// noinspection JSUnusedGlobalSymbols

import {
DataStore,
DisplayComponent,
EventBus,
Facility,
Expand Down Expand Up @@ -165,7 +164,9 @@ class KLN90B extends BaseInstrument {
super.Init();

// noinspection JSIgnoredPromiseFromCall
this.asyncInit();
this.asyncInit().catch(e => {
this.bus.getPublisher<ErrorEvent>().pub("error", e);
});

}

Expand Down Expand Up @@ -221,6 +222,7 @@ class KLN90B extends BaseInstrument {
}

private async asyncInit() {

//The xml is not available before init!
this.planeSettings = new KLN90BPlaneSettingsParser().parsePlaneSettings(this.xmlConfig);

Expand All @@ -237,6 +239,7 @@ class KLN90B extends BaseInstrument {
forceReadyToUse: forceReadyToUse,
});


//From now on, the welcome page may be shown. This gives us time to initialize everything here.
//Lots of coherent calls, might take a while

Expand Down Expand Up @@ -389,6 +392,8 @@ class KLN90B extends BaseInstrument {

//this.bus.onAll(console.log);

}).catch(e => {
this.bus.getPublisher<ErrorEvent>().pub("error", e);
});
}

Expand Down

0 comments on commit b4a4ff2

Please sign in to comment.