Skip to content

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

Merged
theofidry merged 4 commits intohumbug:mainfrom
theofidry:test/fix-show-stacktrace
Apr 14, 2024
Merged

test: Do not hide the original throwable stack trace when failing to parse a file#987
theofidry merged 4 commits intohumbug:mainfrom
theofidry:test/fix-show-stacktrace

Conversation

@theofidry
Copy link
Copy Markdown
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
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