Skip to content
This repository was archived by the owner on Jan 6, 2024. It is now read-only.

improve promise exception #14

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Guzzle6Promise.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function __construct(PromiseInterface $promise, RequestInterface $request
}

if (!($reason instanceof GuzzleExceptions\GuzzleException)) {
throw new \RuntimeException("Invalid reason");
throw new \RuntimeException("Invalid exception returned from Guzzle6", $reason);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is not throw new \RuntimeException("Invalid exception returned from Guzzle6", 0, $reason); ?

And what if the reason is not an exception at all (like a string or other thing) ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ups, good point. i will add a type check there. if its not an exception, i will keep ignoring it, we don't consider returning a string as reason a good idea.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I think it is a UnexpectedValue

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

}

$this->state = self::REJECTED;
Expand Down