mirror of
https://github.com/djohnlewis/stackdump
synced 2025-04-07 18:23:27 +00:00
Added an error page for when Stackdump fails to connect to Solr.
Also unified the error pages and added a generic 500 error page.
This commit is contained in:
parent
e0c96a5c5f
commit
1b27784a8c
python
@ -365,12 +365,12 @@ h1.answers {
|
|||||||
float: right;
|
float: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nodata.row, .importinprogress.row {
|
.nodata.row, .importinprogress.row, .errormessage.row {
|
||||||
margin-top: 50px;
|
margin-top: 50px;
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nodata h2, .importinprogress h2 {
|
.nodata h2, .importinprogress h2, .errormessage h2 {
|
||||||
margin-top: 25px;
|
margin-top: 25px;
|
||||||
margin-bottom: 7px;
|
margin-bottom: 7px;
|
||||||
}
|
}
|
||||||
@ -392,6 +392,6 @@ h1.answers {
|
|||||||
margin-top: 7px;
|
margin-top: 7px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.importinprogress .subinfo {
|
.importinprogress .subinfo, .errormessage .subinfo {
|
||||||
color: #999999;
|
color: #999999;
|
||||||
}
|
}
|
@ -6,6 +6,7 @@ import re
|
|||||||
import math
|
import math
|
||||||
import random
|
import random
|
||||||
import urllib2
|
import urllib2
|
||||||
|
import socket
|
||||||
from xml.etree import ElementTree
|
from xml.etree import ElementTree
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -244,8 +245,19 @@ def error500(error):
|
|||||||
# HACK: the exception object doesn't seem to provide a better way though.
|
# HACK: the exception object doesn't seem to provide a better way though.
|
||||||
if 'database is locked' in ex.args:
|
if 'database is locked' in ex.args:
|
||||||
return render_template('importinprogress.html')
|
return render_template('importinprogress.html')
|
||||||
|
if isinstance(ex, socket.error):
|
||||||
|
# if the error is connection refused, then it is likely because Solr is
|
||||||
|
# not running. Show a nice error message.
|
||||||
|
if ex.errno == 111:
|
||||||
|
return render_template('solrnotrunning.html')
|
||||||
|
|
||||||
# otherwise, return the standard error message
|
# otherwise, return the standard error message
|
||||||
|
if not settings.DEBUG:
|
||||||
|
try:
|
||||||
|
return render_template('500.html')
|
||||||
|
except: # if there are any errors, just render Bottle's default error page.
|
||||||
|
pass
|
||||||
|
|
||||||
return repr(error)
|
return repr(error)
|
||||||
|
|
||||||
@get('/')
|
@get('/')
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
{% extends 'base.html' %}
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
{% block title %}
|
{% block title %}
|
||||||
Stackdump - Error 404: Not Found
|
Stackdump // Error 404: Not Found
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<div class="row nodata">
|
<div class="row errormessage">
|
||||||
<div class="span16">
|
<div class="span16">
|
||||||
<h1>Error 404: Not Found</h1>
|
<h1>Error 404: Not Found</h1>
|
||||||
<p>
|
<p>
|
||||||
|
23
python/src/stackdump/templates/500.html
Normal file
23
python/src/stackdump/templates/500.html
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
{% block title %}
|
||||||
|
Stackdump // Error 500: {{ error.output }}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block body %}
|
||||||
|
<div class="row errormessage">
|
||||||
|
<div class="span16">
|
||||||
|
<h1>Something went wrong.</h1>
|
||||||
|
<p>
|
||||||
|
Stackdump could not complete your request. Try your query again
|
||||||
|
later as this may be a symptom of a high load on the app at the
|
||||||
|
moment.
|
||||||
|
</p>
|
||||||
|
<p class="subinfo">
|
||||||
|
If this issue persists, try restarting the Stackdump daemons/
|
||||||
|
services (<em>stackdump_web</em> and/or <em>stackdump_solr</em>)
|
||||||
|
or processes (<em>start_web.sh</em> and/or <em>start_solr.sh</em>).
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
24
python/src/stackdump/templates/solrnotrunning.html
Normal file
24
python/src/stackdump/templates/solrnotrunning.html
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
{% block title %}
|
||||||
|
Stackdump // cannot connect to the search index
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block body %}
|
||||||
|
<div class="row errormessage">
|
||||||
|
<div class="span16">
|
||||||
|
<h1>Stackdump cannot connect to the search index.</h1>
|
||||||
|
<p>
|
||||||
|
This may be due to a temporary issue (e.g. due to high load).
|
||||||
|
Try your query again later.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class="subinfo">
|
||||||
|
If this issue does not resolve itself in a few minutes, check
|
||||||
|
that the <em>stackdump_solr</em> daemon/service or
|
||||||
|
<em>start_solr.sh</em> process is running.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
Loading…
x
Reference in New Issue
Block a user