-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Add OCS Middleware #475
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
Add OCS Middleware #475
Conversation
|
@rullzer, thanks for your PR! By analyzing the annotation information on this pull request, we identified @BernhardPosselt, @DeepDiver1975 and @nickvergessen to be potential reviewers |
| @@ -0,0 +1,83 @@ | |||
| <?php | |||
| /** | |||
|
|
|||
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.
Empty newline?
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.
Mmm I just ran the license script. Will fix.
|
I like it 👍 |
| * @return OCSResponse | ||
| */ | ||
| public function afterException($controller, $methodName, \Exception $exception) { | ||
| if ($controller instanceof OCSController) { |
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.
I'd probably combine the if with the next if. That way you nest one level less which makes it much more readable
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.
Ah fair enough. Leftover from when I did not have the generic Exception yet. Will fix.
|
Except for merging the two ifs I don't see anything that can be improved. If implemented 👍 |
* OCSException * OCSBadRequestException * OCSForbiddenException * OCSNotFoundException
|
Comments fixed. |
…ion-handling fix(notifications): Notifier::prepare() threw \InvalidArgumentExcepti…
This adds OCSMiddleware so apps that use OCSController have some control about the special way OCS works.
There is the generic OCSException and for now 3 speciailized exceptions for more type safety.
Also deprecated the old \OCP\API
Of course unit tests are added.
CC: @LukasReschke @nickvergessen @MorrisJobke @BernhardPosselt