-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Debug] Allow flatten throwable #26447
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
[Debug] Allow flatten throwable #26447
Conversation
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.
This is BC break. Please read Symfony BC promise. Correct solution is to create new class and deprecate this one.
Is this required? The Debug component converts |
I have a consumer with if (!$exception instanceof \Exception) {
$exception = new FatalThrowableError($exception);
}
$flattenException = FlattenException::create($exception); but why dont allow? |
I already felt like doing this when working on #26028, but I decided against it because of the BC break @ostrolucky mentioned. Right now, Allowing |
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.
This block can probably be simplified now:
@@ -33,7 +33,7 @@ class FlattenException | |||
private $file; | |||
private $line; | |||
|
|||
public static function create(\Exception $exception, $statusCode = null, array $headers = array()) | |||
public static function create(\Throwable $exception, $statusCode = null, array $headers = array()) |
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.
This change will break applications that extend this class and override the create
method.
@@ -178,7 +178,7 @@ public function getTrace() | |||
return $this->trace; | |||
} | |||
|
|||
public function setTraceFromException(\Exception $exception) | |||
public function setTraceFromException(\Throwable $exception) |
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.
This is a BC break for the same reasons.
Backwards-compatible solutions could be:
|
Closing in favor of #26528, which is more advanced now. Thank you @instabledesign for raising the topic. |
pwned my first contribution 😢 |
Don't give up, next time will be better 😉 |
I'm really sorry for that, @instabledesign. I should've waited a couple more days, I suppose. 😓 I just wanted to slip this in before the feature freeze. |
…on (derrabus) This PR was merged into the 4.1-dev branch. Discussion ---------- [Debug] Support any Throwable object in FlattenException | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | yes | Tests pass? | yes | Fixed tickets | #26429 | License | MIT | Doc PR | N/A Alternative to #26447 without BC breaks, follows #26028. This PR removes the need to convert `Throwable` objects into exceptions when working with `FlattenException`. ping @instabledesign @ostrolucky @nicolas-grekas Commits ------- 96c1a6f Support any Throwable object in FlattenException.
Allow Throwable to be Flatten.