web/flows: improve logging

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-05-24 23:43:48 +02:00
parent 8ecac59eca
commit 1679e94956
1 changed files with 6 additions and 7 deletions

View File

@ -94,7 +94,8 @@ export class FlowExecutor extends LitElement implements StageHost {
}); });
} }
submit(payload: FlowChallengeResponseRequest): Promise<void> { submit(payload?: FlowChallengeResponseRequest): Promise<void> {
if (!payload) return Promise.reject();
if (!this.challenge) return Promise.reject(); if (!this.challenge) return Promise.reject();
// @ts-ignore // @ts-ignore
payload.component = this.challenge.component; payload.component = this.challenge.component;
@ -106,9 +107,8 @@ export class FlowExecutor extends LitElement implements StageHost {
}).then((data) => { }).then((data) => {
this.challenge = data; this.challenge = data;
this.postUpdate(); this.postUpdate();
}).catch((e: Response) => { }).catch((e: Error) => {
console.debug(e); this.errorMessage(e.toString());
this.errorMessage(e.statusText);
}).finally(() => { }).finally(() => {
this.loading = false; this.loading = false;
}); });
@ -129,10 +129,9 @@ export class FlowExecutor extends LitElement implements StageHost {
this.setBackground(this.challenge.background); this.setBackground(this.challenge.background);
} }
this.postUpdate(); this.postUpdate();
}).catch((e: Response) => { }).catch((e: Error) => {
console.debug(e);
// Catch JSON or Update errors // Catch JSON or Update errors
this.errorMessage(e.statusText); this.errorMessage(e.toString());
}).finally(() => { }).finally(() => {
this.loading = false; this.loading = false;
}); });