This is an automated email from the ASF dual-hosted git repository.
sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git
The following commit(s) were added to refs/heads/master by this push:
new 1be8842 Allow use of ValueError for reporting user errors
1be8842 is described below
commit 1be884267fb6acb0332aa999510d47e2fcf71616
Author: Sebb <[email protected]>
AuthorDate: Thu Nov 18 22:00:18 2021 +0000
Allow use of ValueError for reporting user errors
This relates to #87
---
server/endpoints/mbox.py | 2 +-
server/endpoints/stats.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/server/endpoints/mbox.py b/server/endpoints/mbox.py
index 3fde4f7..c168384 100644
--- a/server/endpoints/mbox.py
+++ b/server/endpoints/mbox.py
@@ -82,7 +82,7 @@ async def process(
try:
query_defuzzed = plugins.defuzzer.defuzz(indata, list_override="@" in
lid and lid or None)
- except AssertionError as e: # If defuzzer encounters syntax errors, it
will throw an AssertionError
+ except (ValueError, AssertionError) as e: # If defuzzer encounters syntax
errors, it will throw an AssertionError or ValueError
return aiohttp.web.Response(
headers={
"content-type": "text/plain",
diff --git a/server/endpoints/stats.py b/server/endpoints/stats.py
index 68a2aca..9aedbc1 100644
--- a/server/endpoints/stats.py
+++ b/server/endpoints/stats.py
@@ -44,7 +44,7 @@ async def process(
try:
query_defuzzed = plugins.defuzzer.defuzz(indata)
query_defuzzed_nodate = plugins.defuzzer.defuzz(indata, nodate=True)
- except AssertionError as e: # If defuzzer encounters syntax errors, it
will throw an AssertionError
+ except (ValueError, AssertionError) as e: # If defuzzer encounters syntax
errors, it will throw an AssertionError or ValueError
return aiohttp.web.Response(headers={"content-type": "text/plain",},
status=500, text=str(e))
results = await plugins.messages.query(
session, query_defuzzed, query_limit=server.config.database.max_hits