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

Include context backtrace in message #168

Merged
merged 1 commit into from
Mar 26, 2023
Merged

Include context backtrace in message #168

merged 1 commit into from
Mar 26, 2023

Conversation

trowski
Copy link
Member

@trowski trowski commented Mar 5, 2023

PHP does not call __toString() on a previous exception, so our decision to wrap ContextPanicError in a ContextException had the unfortunate side-effect of removing the context trace from the output of an uncaught exception.

There's a couple ways we can approach this. This PR puts the trace as a string into the message. This has the side-effect of needing to create a stack-trace string for uncaught exceptions from Tasks, but is mostly negligible I'd think.

Another approach would be to use reflection to set the $trace property of the parent exception, forcing the child trace to be the trace of the ContextPanicError object.

(new \ReflectionProperty(parent::class, 'trace'))->setValue($this, $originalTrace);

@trowski trowski merged commit 0aa54e1 into 2.x Mar 26, 2023
@trowski trowski deleted the context-backtrace branch March 26, 2023 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant