Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
New extender for error handling #1970
This extender implements several methods for extending the new error
Most use-cases should be covered, but I expect some challenges for more
So taking in consideration the use case mentioned in the issue the usage of this extender would be something like:
return [ (new Extend\ErrorHandling) ->handler(MyException::class, MyExceptionHandler::class) ];
Shouldn't there be an interface for exception handlers, perhaps?
@matteocontrini That depends on the exact use-case. If all you're doing is configuring the status code for an exception, you should use the other methods.
Handlers are really only necessary for adding more details to error output (in the JSON-API layer). #1843 removed most of our layers, and only two remain - those embed validation errors into the JSON-API response. So, assuming you're doing something simpler than that, please try out the other methods.
I thought about it and it does not help much, as that would mean you cannot type hint the argument to the
datitisev left a comment
PHPDoc needed for
This extender implements several methods for extending the new error handling stack implemented in flarum#1843. Most use-cases should be covered, but I expect some challenges for more complex setups. We can tackle those once they come up, though. Basic use-cases should be covered. Fixes flarum#1781.