Mercurial > gemma
diff client/src/components/sections/Sections.vue @ 4868:008bc1ae8897
exception handling
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Tue, 17 Dec 2019 15:05:56 +0100 |
parents | aecba7e66301 |
children | 6b054b91d9b2 |
line wrap: on
line diff
--- a/client/src/components/sections/Sections.vue Tue Dec 17 14:27:44 2019 +0100 +++ b/client/src/components/sections/Sections.vue Tue Dec 17 15:05:56 2019 +0100 @@ -174,20 +174,28 @@ }); }) .catch(error => { - const { status, data } = error.response; + let message = "Problems with backend"; + if (error.response) { + const { status, data } = error.response; + message = `${status}: ${data.message || data}`; + } displayError({ title: this.$gettext("Backend Error"), - message: `${status}: ${data.message || data}` + message: message }); }) .finally(() => (this.loading = false)); }); }) .catch(error => { - const { status, data } = error.response; + let message = "Problems with backend"; + if (error.response) { + const { status, data } = error.response; + message = `${status}: ${data.message || data}`; + } displayError({ title: this.$gettext("Backend Error"), - message: `${status}: ${data.message || data}` + message: message }); }); }, @@ -226,10 +234,14 @@ this.$store .dispatch("imports/loadSections") .catch(error => { - const { status, data } = error.response; + let message = "Problems with backend"; + if (error.response) { + const { status, data } = error.response; + message = `${status}: ${data.message || data}`; + } displayError({ title: this.$gettext("Backend Error"), - message: `${status}: ${data.message || data}` + message: message }); }) .finally(() => (this.loading = false));