summaryrefslogtreecommitdiffstats
path: root/python/fatcat_web/templates
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2020-07-28 16:50:24 -0700
committerBryan Newbold <bnewbold@robocracy.org>2020-07-28 16:50:24 -0700
commit76cec8852f6e431b1c87f7d25f8bd4404f1c67e1 (patch)
tree71138532359586d340ec7784c7543f826bac4abf /python/fatcat_web/templates
parent1301f6ba6c6ea31bdbcd3619d7f235912726f30a (diff)
downloadfatcat-76cec8852f6e431b1c87f7d25f8bd4404f1c67e1.tar.gz
fatcat-76cec8852f6e431b1c87f7d25f8bd4404f1c67e1.zip
search: catch ES errors and display better
Diffstat (limited to 'python/fatcat_web/templates')
-rw-r--r--python/fatcat_web/templates/container_search.html2
-rw-r--r--python/fatcat_web/templates/release_search.html2
-rw-r--r--python/fatcat_web/templates/search_macros.html28
3 files changed, 19 insertions, 13 deletions
diff --git a/python/fatcat_web/templates/container_search.html b/python/fatcat_web/templates/container_search.html
index ce868991..bd92dc2b 100644
--- a/python/fatcat_web/templates/container_search.html
+++ b/python/fatcat_web/templates/container_search.html
@@ -80,6 +80,8 @@
{% endif %}
+{% elif es_error %}
+ {{ search_macros.es_error_msg(es_error) }}
{% endif %}
</div>
diff --git a/python/fatcat_web/templates/release_search.html b/python/fatcat_web/templates/release_search.html
index e004efc1..7fb475e3 100644
--- a/python/fatcat_web/templates/release_search.html
+++ b/python/fatcat_web/templates/release_search.html
@@ -74,6 +74,8 @@
{% endif %}
+{% elif es_error %}
+ {{ search_macros.es_error_msg(es_error) }}
{% endif %}
</div>
diff --git a/python/fatcat_web/templates/search_macros.html b/python/fatcat_web/templates/search_macros.html
index 383c271c..a207bfbc 100644
--- a/python/fatcat_web/templates/search_macros.html
+++ b/python/fatcat_web/templates/search_macros.html
@@ -44,23 +44,25 @@ found.count_returned }} out of {{ found.count_found }} results</i>&nbsp;&nbsp;
{% macro es_error_msg(es_error) %}
<div class="ui icon error message">
<i class="ban icon"></i>
- {% if es_error.status_code == 400 %}
- <div class="content">
- <div class="header">
+ <div class="content">
+ <div class="header">
+ {% if es_error.status_code == 400 %}
Query Error
- </div>
+ {% else %}
+ Search Index Error
+ {% if es_error.status_code %}({{ es_error.status_code }}){% endif %}
+ {% endif %}
+ </div>
+ {% if es_error.description %}
<p>Computer said: <code>{{ es_error.description }}</code>
+ {% elif es_error.name %}
+ <p><b>{{ es_error.name }}</b>
+ {% endif %}
+ {% if es_error.status_code == 400 %}
<p>Query parsing is currently very naive. Sometimes you can fix this
problem by adding quotes around terms or entire phrases.
- </div>
- {% else %}
- <div class="content">
- <div class="header">
- Search Index Error ({{ es_error.status_code }})
- </div>
- <p>Computer said: <code>{{ es_error.description }}</code>
- </div>
- {% endif %}
+ {% endif %}
+ </div>
</div>
{% endmacro %}