8000 [DX] Improve bad controller class error · Issue #11304 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
8000

[DX] Improve bad controller class error #11304

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

Closed
weaverryan opened this issue Jul 5, 2014 · 5 comments
Closed

[DX] Improve bad controller class error #11304

weaverryan opened this issue Jul 5, 2014 · 5 comments
Labels
DX DX = Developer eXperience (anything that improves the experience of using Symfony) Good first issue Ideal for your first contribution! (some Symfony experience may be required)

Comments

@weaverryan
Copy link
Member

Suppose you have this route:

homepage:
    pattern:  /
    defaults: { _controller: "FooBundle:Course2:index" }

But, no Course2Controller exists (you didn't create it yet, typo in its namespace, etc). The current error looks like this:

screen shot 2014-07-04 at 7 58 25 pm

The FooBundle:Course2 is a bit confusing, because I don't recognize that from anywhere (I typed FooBundle:Course2:index). I'd like to improve this error, perhaps:

The _controller value "FooBundle:Course2:index" maps to a "Knp\FooBundle\Controller\Course2Controller" class, but this class was not found. Create this class or check the spelling of the class and its namespace.

@weaverryan weaverryan added the DX label Jul 5, 2014
@javiereguiluz
Copy link
Member

👍

What about adding the name of the route that introduced the problem?

The _controller value "FooBundle:Course2:index" from the "homepage" route maps to a "Knp\FooBundle\Controller\Course2Controller" class, but this class was not found. Create this class or check the spelling name of the class and its namespace.

@sstok
Copy link
Contributor
sstok commented Jul 5, 2014

👍 also great idea with the route-name.

@hhamon
Copy link
Contributor
hhamon commented Jul 5, 2014

👍

@pierredup
Copy link
Contributor

#10788 Adds some better error message when a controller can't be called. I can update that PR with some more info if you like?

@weaverryan
Copy link
Member Author

@pierredup Yea, I really what you're fixing with your PR (I was going to open an issue on this, but your PR beat me)! This issue is for a slightly different message and it already has its own PR (#11314). So, I think we're good for now, but I do also want your PR merged.

Cheers!

@fabpot fabpot closed this as completed Jul 24, 2014
fabpot added a commit that referenced this issue Jul 24, 2014
…vara)

This PR was merged into the 2.6-dev branch.

Discussion
----------

[FrameworkBundle] Improved controller class error

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #11304
| License       | MIT
| Doc PR        |

Commits
-------

da41eb1 [FrameworkBundle] improved controller name parse error message
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DX DX = Developer eXperience (anything that improves the experience of using Symfony) Good first issue Ideal for your first contribution! (some Symfony experience may be required)
Projects
None yet
Development

No branches or pull requests

6 participants
0