-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Messenger] Add previous to the exception output #52951
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
Conversation
Hey! I see that this is your first PR. That is great! Welcome! Symfony has a contribution guide which I suggest you to read. In short:
Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change. When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor! I am going to sit back now and wait for the reviews. Cheers! Carsonbot |
@xabbuh I've created this PR 8 months ago targeting It would really help me out debugging failed messages if this can get merged. |
@@ -188,6 +188,7 @@ private function createCloner(): ?ClonerInterface | |||
Caster::PREFIX_VIRTUAL.'file' => $flattenException->getFile(), | |||
Caster::PREFIX_VIRTUAL.'line' => $flattenException->getLine(), | |||
Caster::PREFIX_VIRTUAL.'trace' => new TraceStub($flattenException->getTrace()), | |||
Caster::PREFIX_VIRTUAL.'previous' => $flattenException->getPrevious(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will it work this way as getPrevious()
returns a FlattenException
instance and not a scalar value? And what about calling getAllPrevious()
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will it work this way as getPrevious() returns a FlattenException instance and not a scalar value?
It shows the trace fine in the terminal, and gives all the information needed for further debugging.
Example:
previous: App\Exception\CustomViolationException^ {#1
message: """
SQLSTATE[23000]: Integrity constraint violation: ...
"""
code: 1062
file: "/app/src/Service/ExampleService.php"
line: 167
trace: {
/app/src/Service/ExampleService.php:167 {
App\Service\ExampleService->updateStuff(array $updateCollection): void^
›
› throw new CustomViolationException(
› message: $e->getMessage(),
}
/app/src/Service/ExampleServiceTwo.php:94 { …}
And what about calling getAllPrevious() instead?
I didn't know about getAllPrevious()
but after trying it out I don't see much difference between the two except for notation.
getPrevious
previous: PDOException^ {
message: "SQLSTATE[23000]: Integrity constraint violation: ...
}
getAllPrevious
previousAll: [
PDOException^ {#3
message: "SQLSTATE[23000]: Integrity constraint violation: ...
...
},
PDOException^ {#3}
]
As it seems the same to me, what do you think is best to use?
Thank you @ToshY. |
Adds
previous
part of the exception to be displayed frommessenger:show:failed <id> -vv
command.