Improve error handling with native app comms for settings (#94)

This commit is contained in:
Erayd
2019-04-14 03:54:13 +12:00
committed by GitHub
parent 8cf375d4ba
commit 0a06ba6009
4 changed files with 23 additions and 5 deletions

View File

@@ -76,6 +76,10 @@ function view(ctl, params) {
if (typeof this.error !== "undefined") {
nodes.push(m("div.error", this.error.message));
}
if (this.settings.hasOwnProperty("hostError")) {
let hostError = this.settings.hostError;
nodes.push(m("div.error", hostError.params.message));
}
nodes.push(
m(
@@ -84,7 +88,7 @@ function view(ctl, params) {
disabled: !this.saveEnabled,
onclick: async () => {
try {
await this.saveSettings(this.settings);
this.settings = await this.saveSettings(this.settings);
this.error = undefined;
} catch (e) {
this.error = e;