Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create custom ErrorMiddleware to support Rest #19

Closed
smalot opened this issue Jun 19, 2018 · 2 comments
Closed

Create custom ErrorMiddleware to support Rest #19

smalot opened this issue Jun 19, 2018 · 2 comments
Milestone

Comments

@smalot
Copy link
Contributor

smalot commented Jun 19, 2018

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
Copy link
Contributor

dkraczkowski commented Jun 20, 2018

Hello, there are already possibilities to achieve this functionality:

  • Throw an exception that implements \Igni\Http\Exception\HttpException
  • Add custom middleware by $app->use() or register module implementing \Igni\Http\MiddlewareProvider

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
Copy link
Contributor

I have also added PR with upgraded docs and improved current http exception handling #20

@dkraczkowski dkraczkowski added this to the 1.3.1 milestone Jun 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants