[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [metrics-web/master] Add error code and message for code 400 responses.
commit da604d9c11e22f3c4b9486b73a77906f6824d04f
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date: Mon Mar 9 11:00:19 2020 +0100
Add error code and message for code 400 responses.
Fixes #32683.
---
src/main/resources/web/js/rs/collections/aggregates.js | 4 +++-
src/main/resources/web/js/rs/collections/results.js | 4 +++-
src/main/resources/web/templates/rs/aggregate/map.html | 7 +++++++
src/main/resources/web/templates/rs/aggregate/search.html | 7 +++++++
src/main/resources/web/templates/rs/search/do.html | 7 +++++++
5 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/src/main/resources/web/js/rs/collections/aggregates.js b/src/main/resources/web/js/rs/collections/aggregates.js
index bbf5a45..bffb7da 100644
--- a/src/main/resources/web/js/rs/collections/aggregates.js
+++ b/src/main/resources/web/js/rs/collections/aggregates.js
@@ -127,7 +127,9 @@ define([
success(err, onionooVersion, buildRevision, relaysPublished,
bridgesPublished);
}).fail(function(jqXHR, textStatus, errorThrown) {
- if(jqXHR.statusText == "error") {
+ if (jqXHR.status / 100 == 4) {
+ error(4);
+ } else if (jqXHR.statusText == "error") {
error(2);
} else {
error(3);
diff --git a/src/main/resources/web/js/rs/collections/results.js b/src/main/resources/web/js/rs/collections/results.js
index 0110b7b..dfec6df 100644
--- a/src/main/resources/web/js/rs/collections/results.js
+++ b/src/main/resources/web/js/rs/collections/results.js
@@ -78,7 +78,9 @@ define([
chunkedLookup();
}).fail(
function(jqXHR, textStatus, errorThrown) {
- if(jqXHR.statusText == "error") {
+ if (jqXHR.status / 100 == 4) {
+ error(4);
+ } else if(jqXHR.statusText == "error") {
error(2);
} else {
error(3);
diff --git a/src/main/resources/web/templates/rs/aggregate/map.html b/src/main/resources/web/templates/rs/aggregate/map.html
index b30e800..8ecb359 100644
--- a/src/main/resources/web/templates/rs/aggregate/map.html
+++ b/src/main/resources/web/templates/rs/aggregate/map.html
@@ -25,6 +25,13 @@
backend IP address. If the problem persits consult <a
href="https://trac.torproject.org/">the bugtracker.</a></p>
</div>
+ <% } else if (error == 4) { %>
+ <div class="alert alert-danger">
+ <strong>Query error!</strong><p>The backend server reports a problem
+ with your query. Please have a look at
+ <a href="#about">the About page</a> that explains what type of search
+ queries are supported by Relay Search.</p>
+ </div>
<% } else if (error == 5) { %>
<div class="alert alert-warning">
<strong>No query submitted!</strong>
diff --git a/src/main/resources/web/templates/rs/aggregate/search.html b/src/main/resources/web/templates/rs/aggregate/search.html
index 151afb6..3046160 100644
--- a/src/main/resources/web/templates/rs/aggregate/search.html
+++ b/src/main/resources/web/templates/rs/aggregate/search.html
@@ -26,6 +26,13 @@
backend IP address. If the problem persits consult <a
href="https://trac.torproject.org/">the bugtracker.</a></p>
</div>
+ <% } else if (error == 4) { %>
+ <div class="alert alert-danger">
+ <strong>Query error!</strong><p>The backend server reports a problem
+ with your query. Please have a look at
+ <a href="#about">the About page</a> that explains what type of search
+ queries are supported by Relay Search.</p>
+ </div>
<% } else if (error == 5) { %>
<div class="alert alert-warning">
<strong>No query submitted!</strong>
diff --git a/src/main/resources/web/templates/rs/search/do.html b/src/main/resources/web/templates/rs/search/do.html
index 1fe06b4..e2a669d 100644
--- a/src/main/resources/web/templates/rs/search/do.html
+++ b/src/main/resources/web/templates/rs/search/do.html
@@ -26,6 +26,13 @@
backend IP address. If the problem persits consult <a
href="https://trac.torproject.org/">the bugtracker.</a></p>
</div>
+ <% } else if (error == 4) { %>
+ <div class="alert alert-danger">
+ <strong>Query error!</strong><p>The backend server reports a problem
+ with your query. Please have a look at
+ <a href="#about">the About page</a> that explains what type of search
+ queries are supported by Relay Search.</p>
+ </div>
<% } else if (error == 5) { %>
<div class="alert alert-warning">
<strong>No query submitted!</strong>
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits