Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A pipe in query text outside of entity label produces cryptic index error #148

Closed
serapio opened this issue May 14, 2020 · 0 comments · Fixed by #158
Closed

A pipe in query text outside of entity label produces cryptic index error #148

serapio opened this issue May 14, 2020 · 0 comments · Fixed by #158

Comments

@serapio
Copy link
Contributor

serapio commented May 14, 2020

If you have a query entity marked up with a missing open brace, the markup parse ends up with an IndexError and little helpful information.
Example query:

book from now|sys_time} until kingdom come

Output:

...
  File "python3.6/site-packages/mindmeld/markup.py", line 81, in load_query
    markup, query_factory=query_factory, query_options=query_options
  File "python3.6/site-packages/mindmeld/markup.py", line 261, in process_markup
    raw_text, annotations = _parse_tokens(_tokenize_markup(markup))
  File "python3.6/site-packages/mindmeld/markup.py", line 398, in _parse_tokens
    annotation = stack[-1]

We should be catching this error in process_markup and making it a MarkupError with msg like

        msg = "Invalid markup in query {!r}: {}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant