comparison client/src/components/gauge/Waterlevel.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
308 }); 308 });
309 this.templateData = response.data.template_data; 309 this.templateData = response.data.template_data;
310 } 310 }
311 ); 311 );
312 }) 312 })
313 .catch(e => { 313 .catch(error => {
314 const { status, data } = e.response; 314 let message = "Problems with backend";
315 if (error.response) {
316 const { status, data } = error.response;
317 message = `${status}: ${data.message || data}`;
318 }
315 displayError({ 319 displayError({
316 title: this.$gettext("Backend Error"), 320 title: this.$gettext("Backend Error"),
317 message: `${status}: ${data.message || data}` 321 message: message
318 }); 322 });
319 }); 323 });
320 } 324 }
321 }, 325 },
322 // Diagram legend 326 // Diagram legend
1288 this.form.template = this.templates[0]; 1292 this.form.template = this.templates[0];
1289 this.templates[this.templates.length] = this.defaultTemplate; 1293 this.templates[this.templates.length] = this.defaultTemplate;
1290 this.applyChange(); 1294 this.applyChange();
1291 } 1295 }
1292 }) 1296 })
1293 .catch(e => { 1297 .catch(error => {
1294 const { status, data } = e.response; 1298 let message = "Problems with backend";
1299 if (error.response) {
1300 const { status, data } = error.response;
1301 message = `${status}: ${data.message || data}`;
1302 }
1295 displayError({ 1303 displayError({
1296 title: this.$gettext("Backend Error"), 1304 title: this.$gettext("Backend Error"),
1297 message: `${status}: ${data.message || data}` 1305 message: message
1298 }); 1306 });
1299 }); 1307 });
1300 }, 1308 },
1301 destroyed() { 1309 destroyed() {
1302 window.removeEventListener("resize", this.resizeListenerFunction); 1310 window.removeEventListener("resize", this.resizeListenerFunction);