Add error code and message for code 400 responses.

Fixes #32683.
This commit is contained in:
Karsten Loesing 2020-03-09 11:00:19 +01:00
parent abf7e92e31
commit da604d9c11
5 changed files with 27 additions and 2 deletions

View File

@ -127,7 +127,9 @@ define([
success(err, onionooVersion, buildRevision, relaysPublished, success(err, onionooVersion, buildRevision, relaysPublished,
bridgesPublished); bridgesPublished);
}).fail(function(jqXHR, textStatus, errorThrown) { }).fail(function(jqXHR, textStatus, errorThrown) {
if(jqXHR.statusText == "error") { if (jqXHR.status / 100 == 4) {
error(4);
} else if (jqXHR.statusText == "error") {
error(2); error(2);
} else { } else {
error(3); error(3);

View File

@ -78,7 +78,9 @@ define([
chunkedLookup(); chunkedLookup();
}).fail( }).fail(
function(jqXHR, textStatus, errorThrown) { function(jqXHR, textStatus, errorThrown) {
if(jqXHR.statusText == "error") { if (jqXHR.status / 100 == 4) {
error(4);
} else if(jqXHR.statusText == "error") {
error(2); error(2);
} else { } else {
error(3); error(3);

View File

@ -25,6 +25,13 @@
backend IP address. If the problem persits consult <a backend IP address. If the problem persits consult <a
href="https://trac.torproject.org/">the bugtracker.</a></p> href="https://trac.torproject.org/">the bugtracker.</a></p>
</div> </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) { %> <% } else if (error == 5) { %>
<div class="alert alert-warning"> <div class="alert alert-warning">
<strong>No query submitted!</strong> <strong>No query submitted!</strong>

View File

@ -26,6 +26,13 @@
backend IP address. If the problem persits consult <a backend IP address. If the problem persits consult <a
href="https://trac.torproject.org/">the bugtracker.</a></p> href="https://trac.torproject.org/">the bugtracker.</a></p>
</div> </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) { %> <% } else if (error == 5) { %>
<div class="alert alert-warning"> <div class="alert alert-warning">
<strong>No query submitted!</strong> <strong>No query submitted!</strong>

View File

@ -26,6 +26,13 @@
backend IP address. If the problem persits consult <a backend IP address. If the problem persits consult <a
href="https://trac.torproject.org/">the bugtracker.</a></p> href="https://trac.torproject.org/">the bugtracker.</a></p>
</div> </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) { %> <% } else if (error == 5) { %>
<div class="alert alert-warning"> <div class="alert alert-warning">
<strong>No query submitted!</strong> <strong>No query submitted!</strong>