-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Confusing error message: 'must define the "event" attribute on "kernel.event_listener" tags' when the problem was nonexistent class #54095
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
Comments
Hey, thanks for your report! |
Indeed. Actually, there hasn't been any activity ever. Maybe time to look into it?
I don't know. Have you done anything to fix it? If not, it almost certainly is still relevant |
@php4fan Would you like to look into how to potentially fix this? |
I'd love to but I don't think I have that much free time unfortunately. |
Hey, thanks for your report! |
Issue still exists on Symfony 7.2.4, nothing has changed. |
#60277 to fix this |
Symfony version(s) affected
5.4
Description
I followed this guide:
https://symfony.com/doc/5.x/event_dispatcher.html
and I created a class
App\Listeners\ExceptionListener.php
but in
services.yaml
I mistyped the class name as:Note the namespace
Listener
without thes
.I got this confusing error:
which didn't help much, because I was becoming stupid trying to figure out why it complained about a missing attribute that should be optional.
Until I figured out I had misspelled the namespace. To the error message's credit, it does repeat the name of the class, so that gives an opportunity to catch it (which I missed), but still, the error message is unnecessarily misleading. It's specifically directing my attention to a place where the issue is not.
The error should have said something like: "Service
App\Listener\ExceptionListener
does not exist." (and if it can add a "Did you mean one of the following...?" that would be great).How to reproduce
In
services.yaml
, add:Possible Solution
No response
Additional Context
No response
The text was updated successfully, but these errors were encountered: