You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You need to implement a custom strategy (you can extend the existing ApplicationStrategy or JsonStrategy), and implement or override the getThrowableHandler() method in your custom strategy.
This method should return an implementation of MiddlewareInterface that forwards the given ServerRequestInterface to the next RequestHandlerInterface, wrapped it in a try/catch so that it can catch any Throwables and convert them to responses.
You can then use your custom strategy on a route group, a single route, or the whole router depending on your needs. In your case I think you'll need to create 2 custom strategies, one for HTML pages and one for JSON endpoints, and assign them to the right routes/groups like you did with the default ApplicationStrategy and JsonStrategy in your example.
Disclaimer: I'm not the author/maintainer of this package.
I like send a Response if Method Not Found o route Not Found
example:
or
The text was updated successfully, but these errors were encountered: