Improve error reporting by appending previous exception messages#26
Merged
WyriHaximus merged 1 commit intoreactphp:masterfrom Oct 11, 2021
Merged
Improve error reporting by appending previous exception messages#26WyriHaximus merged 1 commit intoreactphp:masterfrom
WyriHaximus merged 1 commit intoreactphp:masterfrom
Conversation
kelunik
reviewed
Oct 11, 2021
| }); | ||
|
|
||
| return $promise->then(null, function ($error) use (&$buffer, $bufferer, $stream) { | ||
| return $promise->then(null, function (\Exception $error) use (&$buffer, $bufferer, $stream) { |
Contributor
There was a problem hiding this comment.
Shouldn't these be Throwable?
Contributor
There was a problem hiding this comment.
Why? In case of a TypeError for example, it wont remove the listener here.
Member
Author
There was a problem hiding this comment.
The promise is created a few lines above and only ever rejected with a RuntimeException, hence there's no need to check for Throwable here. Using a Throwable probably wouldn't hurt either in the long run once this targets only newer PHP versions, but at the moment nothing is gained by using Throwable.
WyriHaximus
approved these changes
Oct 11, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This changeset improves error reporting by appending previous exception messages. This improves DX by making it easier to see the underlying error causes without having to check the previous exception via
$e->getPrevious().Refs reactphp/socket#271