Skip to content

Commit

Permalink
Merge pull request #6330 from tomachalek/save_syntax_err_queries
Browse files Browse the repository at this point in the history
Feature - save queries with syntax err to make them appear in history
  • Loading branch information
tomachalek authored Oct 17, 2024
2 parents f935602 + 745b718 commit 5ca964e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/views/concordance.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
from conclib.errors import (
ConcordanceException, ConcordanceQueryParamsError,
ConcordanceSpecificationError, UnknownConcordanceAction,
extract_manatee_error)
ConcordanceQuerySyntaxError, extract_manatee_error)
from conclib.freq import one_level_crit
from conclib.search import get_conc
from corplib.abstract import SubcorpusIdent
Expand Down Expand Up @@ -167,6 +167,12 @@ async def store_last_op(conc_ids: List[str], history_ts: Optional[int], _):
ans['finished'] = conc.finished()
amodel.on_query_store(store_last_op)
resp.set_http_status(201)
except ConcordanceQuerySyntaxError as ex:
# we want queries with syntax errors to be saved, so we suppress
# the error a bit to make amodel.post_dispatch do its work
ans['size'] = 0
ans['finished'] = True
resp.add_system_message('error', str(ex))
except (ConcordanceException, ConcCacheStatusException) as ex:
ans['size'] = 0
ans['finished'] = True
Expand Down

0 comments on commit 5ca964e

Please sign in to comment.