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

exception handling
author Thomas Junk <thomas.junk@intevation.de>
date Tue, 17 Dec 2019 15:05:56 +0100
parents b6d8570b8480
children 6b054b91d9b2
comparison
equal deleted inserted replaced
4867:5555b77b8c4e 4868:008bc1ae8897
169 this.form.template = this.templates[0]; 169 this.form.template = this.templates[0];
170 this.templates[this.templates.length] = this.defaultTemplate; 170 this.templates[this.templates.length] = this.defaultTemplate;
171 this.applyChange(); 171 this.applyChange();
172 } 172 }
173 }) 173 })
174 .catch(e => { 174 .catch(error => {
175 const { status, data } = e.response; 175 let message = "Problems with backend";
176 if (error.response) {
177 const { status, data } = error.response;
178 message = `${status}: ${data.message || data}`;
179 }
176 displayError({ 180 displayError({
177 title: this.$gettext("Backend Error"), 181 title: this.$gettext("Backend Error"),
178 message: `${status}: ${data.message || data}` 182 message: message
179 }); 183 });
180 }); 184 });
181 }, 185 },
182 computed: { 186 computed: {
183 ...mapState("fairwayavailability", [ 187 ...mapState("fairwayavailability", [
357 }); 361 });
358 this.templateData = response.data.template_data; 362 this.templateData = response.data.template_data;
359 } 363 }
360 ); 364 );
361 }) 365 })
362 .catch(e => { 366 .catch(error => {
363 const { status, data } = e.response; 367 let message = "Problems with backend";
368 if (error.response) {
369 const { status, data } = error.response;
370 message = `${status}: ${data.message || data}`;
371 }
364 displayError({ 372 displayError({
365 title: this.$gettext("Backend Error"), 373 title: this.$gettext("Backend Error"),
366 message: `${status}: ${data.message || data}` 374 message: message
367 }); 375 });
368 }); 376 });
369 } 377 }
370 }, 378 },
371 downloadPDF() { 379 downloadPDF() {