From de200895e2132531fab8598dfc8a5ace8e8aa7b1 Mon Sep 17 00:00:00 2001 From: 4gray <4gray@users.noreply.github.com> Date: Sat, 1 Jul 2023 10:37:29 +0200 Subject: [PATCH] refactor: improve error message handling --- src/app/app.component.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 22dd27077..cb66d247e 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -233,11 +233,14 @@ export class AppComponent { showErrorAsNotification(response: { message: string; status: number }) { this.snackBar.open( - `Error: ${response.message} (Status: ${response.status})`, + `Error: ${response?.message ?? 'Something went wrong'} (Status: ${ + response?.status ?? 0 + })`, null, { duration: 4000 } ); } + /** * Removes all ipc command listeners on component destroy */