fix: added error handling to ES search
This commit is contained in:
parent
58fce87f39
commit
b34d1130ed
2 changed files with 20 additions and 1 deletions
|
|
@ -587,8 +587,14 @@ class AdminSettingsView(BaseAppView):
|
|||
c.active = "search"
|
||||
|
||||
c.searcher = searcher_from_config(self.request.registry.settings)
|
||||
c.statistics = c.searcher.statistics(self.request.translate)
|
||||
c.error = None
|
||||
c.statistics = None
|
||||
|
||||
try:
|
||||
c.statistics = c.searcher.statistics(self.request.translate)
|
||||
except Exception as e:
|
||||
log.exception("Exception during search statistics retrieval")
|
||||
c.error = e
|
||||
return self._get_template_context(c)
|
||||
|
||||
@LoginRequired()
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
</div>
|
||||
<div class="panel-body">
|
||||
<dl class="dl-horizontal">
|
||||
% if c.statistics:
|
||||
% for stat in c.statistics:
|
||||
% if stat.get('sep'):
|
||||
<dt></dt>
|
||||
|
|
@ -13,6 +14,18 @@
|
|||
<dd>${stat['value']}</dd>
|
||||
% endif
|
||||
% endfor
|
||||
% endif
|
||||
|
||||
% if c.error:
|
||||
<div class="panel panel-danger">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">${_('ERROR')}</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
${c.error}
|
||||
</div>
|
||||
</div>
|
||||
% endif
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue