Conversation
|
It requires some tests to cover the following cases:
It might have to be rebased on |
|
We need a way to obtain the error message, probably through |
2c9586c to
b2e9dc7
Compare
|
Maybe it would be a good thing to set the status code before invoking the handler. The default handling would only be for specific exceptions. |
|
One important thing to document is the capability for status handler to change the thrown A status handler can turn a |
f53722f to
48ffb12
Compare
|
Setting the status code is not a good thing and will cause problems if another Moreover, the response should be in the exact same state it was when the exception was thrown. |
518e548 to
bd45c61
Compare
|
Using the request parameters can have the dangerous side-effect of overwritting existing keys in the parameters. However, it does matter only if the original |
3f35fe8 to
1d68a33
Compare
fb0e287 to
a301a6c
Compare
1d68a33 to
569be0d
Compare
a301a6c to
05ceb04
Compare
The status handler is invoked with perform_routing, so next can be used to jump to the next status handler for a given status. If nothing matches, the router handler is used. Status handler must set the status code in the response as it remained in the exact same state it was when the exception were thrown. It also captures generated NOT_FOUND and METHOD_NOT_ALLOWED to provide a uniform approach at handling status codes.
Keys 'code' and 'message' are setted in the request parameters so that the status handler can access that information. The request parameters are initialized if still null, which might happen if no matcher has populated them. Optimally, that information would go through a state, but this is not really easy to do without making major modifications to the router.
05ceb04 to
0ba45dc
Compare
0ba45dc to
f0f831f
Compare
|
Merged directly into |
The status handler is invoked with perform_routing, so next can be used to jump
to the next status handler for a given status. If nothing matches, the router
handler is used.
The great thing about this implementation is that it reuses
perform_routingand fallbacks onRouterdefault handling if a status is not handled.