Skip to content

clients may only throw http exceptions, deprecate configuring other e… #35

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

Merged
merged 1 commit into from
Jan 7, 2019
Merged
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
6 changes: 6 additions & 0 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ public function doSendRequest(RequestInterface $request)
*/
public function addException(\Exception $exception)
{
if (!$exception instanceof Exception) {
@trigger_error('Clients may only throw exceptions of type '.Exception::class.'. Setting an exception of class '.get_class($exception).' will not be possible anymore in the future', E_USER_DEPRECATED);
}
$this->exceptions[] = $exception;
}

Expand All @@ -102,6 +105,9 @@ public function addException(\Exception $exception)
*/
public function setDefaultException(\Exception $defaultException = null)
{
if (!$defaultException instanceof Exception) {
@trigger_error('Clients may only throw exceptions of type '.Exception::class.'. Setting an exception of class '.get_class($defaultException).' will not be possible anymore in the future', E_USER_DEPRECATED);
}
$this->defaultException = $defaultException;
}

Expand Down