Add backend size limits on query area/execution time

This commit is contained in:
Logan Williams
2023-01-20 16:10:39 +01:00
parent 689e2662d0
commit 69800fbc89
3 changed files with 36 additions and 7 deletions

View File

@@ -8,6 +8,7 @@
<title>Bellingcat OpenStreetMap search</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@mdi/font@latest/css/materialdesignicons.min.css">
<script defer data-domain="osm.baarle-hertog.xyz" src="https://plausible.io/js/script.js"></script>
</head>
<body>
<noscript>

View File

@@ -101,7 +101,12 @@ export default new Vuex.Store({
},
}
)
.then((d) => d.json())
.then((d) => {
if (d.status != 200) {
return Promise.reject(Error(d.status));
}
return d.json();
})
.then((data) => {
let time2 = performance.now();
commit("setResponseTime", time2 - time1);
@@ -109,12 +114,21 @@ export default new Vuex.Store({
commit("setLoading", false);
commit("setError", false);
})
.catch(() => {
.catch((e) => {
commit("setLoading", false);
commit(
"setError",
"Search error. Check your custom features or email logan@bellingcat.com."
);
if (e.message == 400) {
commit("setLoading", false);
commit(
"setError",
"Your search area is too large, or your search timed out. Zoom in on a smaller area or change your search parameters. Adding a point feature (green) will increase speed."
);
} else {
commit("setLoading", false);
commit(
"setError",
"Search error. Check your custom features or email logan@bellingcat.com."
);
}
});
},
},