Skip to content

Commit

Permalink
Better logging of exception during query processing
Browse files Browse the repository at this point in the history
  • Loading branch information
vthorsteinsson committed Jul 8, 2024
1 parent 139fe76 commit 26bb4ef
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion article.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ def entity_names(self) -> Iterator[str]:
for t in sent:
if t.get("k") == TOK.ENTITY:
# The entity name
yield cast(str, t.get("x", ""))
yield t.get("x", "")

def gen_text(self) -> Iterator[str]:
"""A generator for text from an article token stream"""
Expand Down
4 changes: 2 additions & 2 deletions queries/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1508,8 +1508,8 @@ def process_query(
return result

except Exception as e:
logging.error(f"Error processing query: {e}")
result = dict(valid=False, error=f"E_EXCEPTION: {e}")
logging.error(f"Error processing query: {repr(e)}")
result = dict(valid=False, error=f"E_EXCEPTION: {repr(e)}")

# If we get here, we failed to answer the query
result["valid"] = False
Expand Down
2 changes: 1 addition & 1 deletion settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
from reynir.basics import ConfigError, LineReader

# Do not remove, relied on by other modules who import changedlocale via settings
from reynir.basics import changedlocale
from reynir.basics import changedlocale # type: ignore


class NoIndexWords:
Expand Down

0 comments on commit 26bb4ef

Please sign in to comment.