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

Naming conflict for "ErrorHandler" which actually is a middleware and not a RequestHandler #3

Closed
weierophinney opened this issue Dec 31, 2019 · 5 comments

Comments

@weierophinney
Copy link
Member

Hey there,

I am giving some trainings regarding zend-expressive, e.g. for some colleagues.
One thing, which always came back to me as a question was:

Why is the ErrorHandler called ErrorHandler like all those request handlers and not ErrorMiddleware which actually suits better as its a middleware per definition.

Would like to see the next major version where the ErrorHandler is renamed to ErrorMiddleware.

Any thoughts on this?


Originally posted by @boesing at zendframework/zend-stratigility#190

@weierophinney
Copy link
Member Author

We can do this by doing the following:

  • Introduce a new minor version that creates the new class, and then has ErrorHandler extend it. The constructor can then emit an E_USER_DEPRECATION message indicating the new name, and how to configure it.
  • The new major version would then remove it.

Please feel free to submit a PR against develop to accomplish the first step.


Originally posted by @weierophinney at zendframework/zend-stratigility#190 (comment)

@weierophinney
Copy link
Member Author

I like the idea of providing that new ErrorMiddleware.
I am not sure if triggering a deprecation message is a good idea.
As of zend-expressive, the ErrorHandler is being automatically set to the configuration.
So after updating zend-stratigility, every zend-expressive project will receive deprecation messages.

I would rather implement just a @deprecated tag, so that the handler can be safely removed in v4 instead.
A migration guide should probably mention that the registered delegators should attach the listeners to the new middleware, as just "aliasing" wont be enough. (Some more details can be found in this comment zendframework/zend-mvc#294 (comment))

I will provide a PR shortly with the changes.


Originally posted by @boesing at zendframework/zend-stratigility#190 (comment)

@boesing
Copy link
Member

boesing commented May 9, 2023

@weierophinney this wasn't integrated or do I miss something?
"as completed" sounds like something was implemented tho.

@weierophinney
Copy link
Member Author

It wasn't integrated, and #7 was closed (by you) back in 2020, so I figured it was dead in the water.#43

We can re-open if you'd like, or we can message that we will consider a patch if submitted.

@boesing
Copy link
Member

boesing commented May 9, 2023

It was actually requested by me as well, I closed it as no1 reviewed it for quite some time but I also think it could be good to keep this as some kind of RFC. Back in the days, we did not had RFCs and I still would love to have some more reasonable naming strategies regarding this package as outlined in the PR:

the NotFoundHandler is definitely a handler which does not delegate the request to the next handler and still is in the Middleware namespace. So it has to be a middleware? 🤷‍♂
Fix for that is in #8

However, I am not too keen about this change and thus I don't care too much. I got some feedback back in 2019 while I've given a training for mezzio in our company and people were actually wondering why the ErrorHandler is a middleware.

I just wonder if there are ways to close issues without marking them as complete.

@boesing boesing closed this as not planned Won't fix, can't repro, duplicate, stale May 9, 2023
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