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

test: Do not hide the original throwable stack trace when failing to parse a file #987

Merged
merged 4 commits into from
Apr 14, 2024

Conversation

theofidry
Copy link
Member

When a spec file could not be parsed, a self::fail() was used instead of letting the throwable bubble up. This was done to know which fail failed to parsed.

The implementation however, is faulty as if an exception is thrown, there is no stack trace. This is especially annoying when the throwable may not be thrown due to an invalid spec file but due to the way this file is parsed (i.e. code within the PhpScoperSpecTest).

This PR introduces a new exception which will contain the previously thrown exception but will also include a more friendly message to easily know for which file this was caused.

theofidry and others added 2 commits April 13, 2024 13:21
parse a file

When a spec file could not be parsed, a `self::fail()` was used instead
of letting the throwable bubble up. This was done to know which fail
failed to parsed.

The implementation however, is faulty as if an exception is thrown,
there is no stack trace. This is especially annoying when the throwable
may not be thrown due to an invalid spec file but due to the way this
file is parsed (i.e. code within the `PhpScoperSpecTest`).

This PR introduces a new exception which will contain the previously
thrown exception but will also include a more friendly message to easily
know for which file this was caused.
@theofidry theofidry enabled auto-merge (squash) April 13, 2024 11:25
@theofidry theofidry merged commit 14ba8f0 into humbug:main Apr 14, 2024
126 checks passed
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 this pull request may close these issues.

1 participant