Browse Source

Catch and display search errors more usefully.

pull/24/head
Ben Kurtovic 10 years ago
parent
commit
b3e1862726
2 changed files with 13 additions and 4 deletions
  1. +9
    -4
      copyvios/checker.py
  2. +4
    -0
      templates/index.mako

+ 9
- 4
copyvios/checker.py View File

@@ -67,10 +67,15 @@ def _get_results(query, follow=True):
if not query.nocache:
query.result = _get_cached_results(page, conn, mode, query.noskip)
if not query.result:
query.result = page.copyvio_check(
min_confidence=T_SUSPECT, max_queries=10, max_time=45,
no_searches=not use_engine, no_links=not use_links,
short_circuit=not query.noskip)
try:
query.result = page.copyvio_check(
min_confidence=T_SUSPECT, max_queries=10, max_time=45,
no_searches=not use_engine, no_links=not use_links,
short_circuit=not query.noskip)
except exceptions.SearchQueryError as exc:
query.error = "search error"
query.exception = exc
return
query.result.cached = False
_cache_result(page, query.result, conn, mode)
elif query.action == "compare":


+ 4
- 0
templates/index.mako View File

@@ -30,6 +30,10 @@
<div id="info-box" class="red-box">
<p>The URL <a href="${query.url | h}">${query.url | h}</a> timed out before any data could be retrieved.</p>
</div>
% elif query.error == "search error"
<div id="info-box" class="red-box">
<p>An error occurred while using the search engine (${query.exception}). Try reloading the page. If the error persists, <a href="${request.url | httpsfix, h}&amp;use_engine=0">repeat the check without using the search engine</a>.</p>
</div>
% elif not query.site:
<div id="info-box" class="red-box">
<p>The given site (project=<b><span class="mono">${query.project | h}</span></b>, language=<b><span class="mono">${query.lang | h}</span></b>) doesn't seem to exist. It may also be closed or private. <a href="//${query.lang | h}.${query.project | h}.org/">Confirm its URL.</a></p>


Loading…
Cancel
Save