comparison client/src/components/fairway/BottleneckDialogue.vue @ 4868:008bc1ae8897

exception handling
author Thomas Junk <thomas.junk@intevation.de>
date Tue, 17 Dec 2019 15:05:56 +0100
parents 00a2c761493e
children 6b054b91d9b2
comparison
equal deleted inserted replaced
4867:5555b77b8c4e 4868:008bc1ae8897
754 this.$gettext("Deleting ") + 754 this.$gettext("Deleting ") +
755 `${this.selectedBottleneck}: ${this.selectedSurvey.date_info}` 755 `${this.selectedBottleneck}: ${this.selectedSurvey.date_info}`
756 }); 756 });
757 }) 757 })
758 .catch(error => { 758 .catch(error => {
759 const { status, data } = error.response; 759 let message = "Problems with backend";
760 if (error.response) {
761 const { status, data } = error.response;
762 message = `${status}: ${data.message || data}`;
763 }
760 displayError({ 764 displayError({
761 title: this.$gettext("Backend Error"), 765 title: this.$gettext("Backend Error"),
762 message: `${status}: ${data.message || data}` 766 message: message
763 }); 767 });
764 }); 768 });
765 }, 769 },
766 deleteSelectedCut(cut) { 770 deleteSelectedCut(cut) {
767 this.$store.commit("application/popup", { 771 this.$store.commit("application/popup", {
809 }); 813 });
810 } 814 }
811 }, 815 },
812 mounted() { 816 mounted() {
813 this.$store.dispatch("usermanagement/loadUsers").catch(error => { 817 this.$store.dispatch("usermanagement/loadUsers").catch(error => {
814 const { status, data } = error.response; 818 let message = "Problems with backend";
819 if (error.response) {
820 const { status, data } = error.response;
821 message = `${status}: ${data.message || data}`;
822 }
815 displayError({ 823 displayError({
816 title: this.$gettext("Backend Error"), 824 title: this.$gettext("Backend Error"),
817 message: `${status}: ${data.message || data}` 825 message: message
818 }); 826 });
819 }); 827 });
820 this.$store.dispatch("bottlenecks/loadBottlenecksList"); 828 this.$store.dispatch("bottlenecks/loadBottlenecksList");
821 } 829 }
822 }; 830 };