[8.0] Rework HandlesOAuthErrors trait to middleware #937
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.
The benefit this gives is that it allows developers to overwrite the middleware and implement their own handling of errors if they want to. At the moment they were stuck with the implementation being a trait so the only way to overwrite the implementation was to rebind their own controllers.
With the new implementation you could bind a new middleware which extends the current one like so:
At least it'll become way easier for developers to customize this than before. It also makes much more sense to handle the error handling in a middleware than through a trait. Given, the previous implementation was probably just an old one and just needed a refresh.
Added tests for the new middleware and removed the old one. Also removed the tests for the controllers (which aren't needed anymore now).
Sent this in to master because of the obvious breaking changes.
Fixes #289