comparison client/src/components/gauge/HydrologicalConditions.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
317 }); 317 });
318 this.templateData = response.data.template_data; 318 this.templateData = response.data.template_data;
319 } 319 }
320 ); 320 );
321 }) 321 })
322 .catch(e => { 322 .catch(error => {
323 const { status, data } = e.response; 323 let message = "Problems with backend";
324 if (error.response) {
325 const { status, data } = error.response;
326 message = `${status}: ${data.message || data}`;
327 }
324 displayError({ 328 displayError({
325 title: this.$gettext("Backend Error"), 329 title: this.$gettext("Backend Error"),
326 message: `${status}: ${data.message || data}` 330 message: message
327 }); 331 });
328 }); 332 });
329 } 333 }
330 }, 334 },
331 // Diagram legend 335 // Diagram legend
1135 this.form.template = this.templates[0]; 1139 this.form.template = this.templates[0];
1136 this.templates[this.templates.length] = this.defaultTemplate; 1140 this.templates[this.templates.length] = this.defaultTemplate;
1137 this.applyChange(); 1141 this.applyChange();
1138 } 1142 }
1139 }) 1143 })
1140 .catch(e => { 1144 .catch(error => {
1141 const { status, data } = e.response; 1145 let message = "Problems with backend";
1146 if (error.response) {
1147 const { status, data } = error.response;
1148 message = `${status}: ${data.message || data}`;
1149 }
1142 displayError({ 1150 displayError({
1143 title: this.$gettext("Backend Error"), 1151 title: this.$gettext("Backend Error"),
1144 message: `${status}: ${data.message || data}` 1152 message: message
1145 }); 1153 });
1146 }); 1154 });
1147 }, 1155 },
1148 destroyed() { 1156 destroyed() {
1149 window.removeEventListener("resize", this.resizeListenerFunction); 1157 window.removeEventListener("resize", this.resizeListenerFunction);