changeset 5139:8a7c39804d2f

layers: log errors additinally to console.
author Thomas Junk <thomas.junk@intevation.de>
date Tue, 31 Mar 2020 09:32:23 +0200
parents c9bca9a9666c
children 11c4c5b8041c
files client/src/components/layers/layers.js
diffstat 1 files changed, 22 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/components/layers/layers.js	Mon Mar 30 19:41:04 2020 +0200
+++ b/client/src/components/layers/layers.js	Tue Mar 31 09:32:23 2020 +0200
@@ -49,15 +49,20 @@
       }
     )
       .then(response => {
-        const features = new GeoJSON().readFeatures(
-          JSON.stringify(response.data)
-        );
-        if (featurePostProcessor) {
-          features.map(f => featurePostProcessor(f, store, features));
+        try {
+          const features = new GeoJSON().readFeatures(
+            JSON.stringify(response.data)
+          );
+          if (featurePostProcessor) {
+            features.map(f => featurePostProcessor(f, store, features));
+          }
+          vectorSource.addFeatures(features);
+        } catch (error) {
+          console.log(error);
         }
-        vectorSource.addFeatures(features);
       })
-      .catch(() => {
+      .catch(error => {
+        console.log(error);
         vectorSource.removeLoadedExtent(extent);
         store.dispatch("application/reportBackendError");
       });
@@ -362,7 +367,8 @@
                 .then(response => {
                   tile.getImage().src = URL.createObjectURL(response.data);
                 })
-                .catch(() => {
+                .catch(error => {
+                  console.log(error);
                   store.dispatch("application/reportBackendError");
                 });
             } // TODO  tile.setState(TileState.ERROR);
@@ -392,7 +398,8 @@
                 .then(response => {
                   tile.getImage().src = URL.createObjectURL(response.data);
                 })
-                .catch(() => {
+                .catch(error => {
+                  console.log(error);
                   store.dispatch("application/reportBackendError");
                 });
             } // TODO  tile.setState(TileState.ERROR);
@@ -497,7 +504,8 @@
                 .then(response => {
                   tile.getImage().src = URL.createObjectURL(response.data);
                 })
-                .catch(() => {
+                .catch(error => {
+                  console.log(error);
                   store.dispatch("application/reportBackendError");
                 });
             } // TODO  tile.setState(TileState.ERROR);
@@ -628,7 +636,8 @@
                 .then(response => {
                   tile.getImage().src = URL.createObjectURL(response.data);
                 })
-                .catch(() => {
+                .catch(error => {
+                  console.log(error);
                   store.dispatch("application/reportBackendError");
                 });
             } // TODO  tile.setState(TileState.ERROR);
@@ -702,7 +711,8 @@
                 .then(response => {
                   tile.getImage().src = URL.createObjectURL(response.data);
                 })
-                .catch(() => {
+                .catch(error => {
+                  console.log(error);
                   store.dispatch("application/reportBackendError");
                 });
             } // TODO  tile.setState(TileState.ERROR);