-
-
Notifications
You must be signed in to change notification settings - Fork 289
IndexError
s are handled differently than other exceptions
#573
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
Comments
… by pyparsing exception handlers (Issue #573)
Thanks - I actually had some code around this as being expected behavior, but giving it a re-think, I worked out how to keep parse action IndexErrors from getting misread as ParserElement.parseImpl IndexErrors. In the bargain, I also enhanced the run_tests output to now indicate if an exception is raised, if it is raised in a parse action, and reports the parse action by name. For your case, I now get this output:
This fix will go out in the next release. |
Please try again using 3.2.0rc1, which I just pushed to PyPI. |
Just tested in a non-trivial codebase and the error message now shows exactly where the underlying |
Released in 3.2.0, closing. |
When a parse action raises an
IndexError
, it does not bubble up the exception message as it would other types of exceptions. This makes it hard to debug how/why my parse action is failing if it raises anIndexError
.minimal example:
outputs
which properly bubbles up the exception raised when parsing "hello" but fails with an ambiguous error when parsing "world".
It should print
FAIL-EXCEPTION: IndexError: this does not
even if the parse action raises anIndexError
The text was updated successfully, but these errors were encountered: