-
Notifications
You must be signed in to change notification settings - Fork 17
Implement default response and exception #21
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
Implement default response and exception #21
Conversation
3db9075
to
5ff102f
Compare
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.
looks useful to me!
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.
noticed that the doc comments could be more specific
src/Client.php
Outdated
@@ -82,6 +100,16 @@ public function addException(\Exception $exception) | |||
} | |||
|
|||
/** | |||
* Sets the default exception to throw if none added. |
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.
... to throw when the list of added exceptions and responses is exhausted.
and maybe add a second bit saying "If both a default exception and a default response are set, the exception will be thrown."
src/Client.php
Outdated
@@ -92,6 +120,16 @@ public function addResponse(ResponseInterface $response) | |||
} | |||
|
|||
/** | |||
* Sets the default response to be returned if none added. |
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.
same as for setDefaultException
5ff102f
to
9490607
Compare
@dbu updated. |
Thanks a lot @soullivaneuh |
You are welcome! 👍 Any chance to have a new minor release for that? :-) |
What's in this PR?
It allows to set a default response or exception if we don't care about what to returns but can't return an empty one.
Why?
This implements an idea from @dbu (#3 (comment)).
But this is a partial resolution of #3 only.
Example Usage
See the documentation PR.
Checklist