Skip to content

armgit / mwmbl

Public Imported from GitHub
0

An open source, non-profit web search engine

Better logging for confusing error

Daoud Clarke0477c27da9d4
diff --git a/mwmbl/tinysearchengine/rank.py b/mwmbl/tinysearchengine/rank.py
index 9586ae4..2cfdd2e 100644
--- a/mwmbl/tinysearchengine/rank.py
+++ b/mwmbl/tinysearchengine/rank.py
@@ -82,7 +82,11 @@ def get_domain_score(url):
def get_match_features(terms, result_string, is_complete, is_url):
query_regex = get_query_regex(terms, is_complete, is_url)
- matches = list(re.finditer(query_regex, result_string, flags=re.IGNORECASE))
+ try:
+ matches = list(re.finditer(query_regex, result_string, flags=re.IGNORECASE))
+ except TypeError:
+ logger.exception(f"Error getting match features, regex: {query_regex} result string: {result_string}")
+ raise
# match_strings = {x.group(0).lower() for x in matches}
# match_length = sum(len(x) for x in match_strings)