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

exception handling
author Thomas Junk <thomas.junk@intevation.de>
date Tue, 17 Dec 2019 15:05:56 +0100
parents ad2ad7bae4a6
children 6b054b91d9b2
comparison
equal deleted inserted replaced
4867:5555b77b8c4e 4868:008bc1ae8897
398 }); 398 });
399 this.templateData = response.data.template_data; 399 this.templateData = response.data.template_data;
400 } 400 }
401 ); 401 );
402 }) 402 })
403 .catch(e => { 403 .catch(error => {
404 const { status, data } = e.response; 404 let message = "Problems with backend";
405 if (error.response) {
406 const { status, data } = error.response;
407 message = `${status}: ${data.message || data}`;
408 }
405 displayError({ 409 displayError({
406 title: this.$gettext("Backend Error"), 410 title: this.$gettext("Backend Error"),
407 message: `${status}: ${data.message || data}` 411 message: message
408 }); 412 });
409 }); 413 });
410 } 414 }
411 }, 415 },
412 downloadPDF() { 416 downloadPDF() {
829 this.form.template = this.templates[0]; 833 this.form.template = this.templates[0];
830 this.templates[this.templates.length] = this.defaultTemplate; 834 this.templates[this.templates.length] = this.defaultTemplate;
831 this.applyChange(); 835 this.applyChange();
832 } 836 }
833 }) 837 })
834 .catch(e => { 838 .catch(error => {
835 const { status, data } = e.response; 839 let message = "Problems with backend";
840 if (error.response) {
841 const { status, data } = error.response;
842 message = `${status}: ${data.message || data}`;
843 }
836 displayError({ 844 displayError({
837 title: this.$gettext("Backend Error"), 845 title: this.$gettext("Backend Error"),
838 message: `${status}: ${data.message || data}` 846 message: message
839 }); 847 });
840 }); 848 });
841 }, 849 },
842 updated() { 850 updated() {
843 this.drawDiagram(); 851 this.drawDiagram();