Yii3: Add a common failure handling pattern to the middlewares. #213
Closed
olegbaturin
started this conversation in
Ideas
Replies: 1 comment
-
We can also go further and make it as a contract for all frameworks' middlewares |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Sometimes middlewares stop processing request with their own error and return themselves a simple error response with only status and status text as the body. But error response is part of the application, and middleware must provide a way to customize it. So, the proposal is to make a common pattern for handling middleware errors from the app.
Below is a list of packages and classes that currently return error responses. Some of them have the failure handler, but others do not.
Examples of failure handlers implemented well
To ensure uniform configuration, the constructor parameter should be named the same in all middlewares, failureHandler of fallbackHandler.
Example of configuring failure handlers in the middleware constructor
Beta Was this translation helpful? Give feedback.
All reactions