igniphp / framework

Swoole, PSR-15, PSR-7, PSR-11 lightweight modular anti-framework for REST micro-services.
MIT License
265 stars 14 forks source link

Create custom ErrorMiddleware to support Rest #19

Closed smalot closed 6 years ago

smalot commented 6 years ago

If you want to create a full Rest API, you need to override the ErrorMiddleware. But this suppose to override the Application too because de ErrorMiddleware is added by default with too many code overriden due to "private" properties and methods.

It should be a good thing to restrict "private" properties and methods only when realy needed for security reasons or to forced code override in case of inheritance.

What's your point of view ?

dkraczkowski commented 6 years ago

Hello, there are already possibilities to achieve this functionality:

I was also thinking about extending ErrorMiddleware and replacing it with one defined by user if it gets registered. But this will destroy modules that are implementing OnErrorListener interface.

dkraczkowski commented 6 years ago

I have also added PR with upgraded docs and improved current http exception handling https://github.com/igniphp/framework/pull/20