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

[DX] improve file loader errors for router #11958

Closed
lmammino opened this issue Sep 19, 2014 · 9 comments
Closed

[DX] improve file loader errors for router #11958

lmammino opened this issue Sep 19, 2014 · 9 comments
Labels
Config 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

@lmammino
Copy link

I had this error today after pulling out the commit of a colleague (he just had created a new bundle):

Cannot load resource "@AcmeDemoBundle/Controller/". Make sure the "AcmeDemoBundle" bundle is correctly registered and loaded in the application kernel class.

The bundle was correctly created and registered. The problem was that he hadn't written any controller (and deleted the default one). So the Controller folder remained empty and wasn't committed.

I struggled out for a while before having been able to find the problem.
I think the error message is wrong here. We might improve it and just state the the "/Controller" folder was missing in the bundle. Didn't had a look at the code yet but I think it can be easy to add this check and improve the error message.

What do you think?

@stof stof added Routing DX DX = Developer eXperience (anything that improves the experience of using Symfony) labels Sep 20, 2014
@javiereguiluz
Copy link
Member

@lmammino I think that this is a proposal that we should take into account. This error may not happen often, but when it occurs, the error message is totally misleading.

The solution could be easy: just after these lines that set the "Cannot load resource %s" part, we could add some check to see if the directory exists and is readable, just before these other lines which output the bundle related message.

@linaori
Copy link
Contributor

linaori commented Sep 27, 2014

@javiereguiluz This is probably not the only case where things like that happen. Would it be an idea to allow some sort of error analyzing in general? Symfony already has the ability to suggest typo issues for example.

@javiereguiluz
Copy link
Member

@iltar you are right. But I love to evolve the framework in small but continuous steps. If we look for all kind of errors and try to fix them all at once, the PR will take months ... and it will probably never be merged. Fixing this issue is a quick win both for the framework and the end user.

@lmammino
Copy link
Author

lmammino commented Oct 3, 2014

I do agree with both you @javiereguiluz and @iltar. It's good to fix this ASAP and maybe we can start having a global look at the error messages for the whole framework and see if there's something else we can fix/improve.

@Tobion Tobion added Config and removed Routing labels Jan 16, 2015
@fabpot
Copy link
Member

fabpot commented Feb 10, 2015

Anyone willing to work on this one? Or let's close it.

@fabpot fabpot added the Good first issue Ideal for your first contribution! (some Symfony experience may be required) label Feb 10, 2015
@BentoumiTech
Copy link
Contributor

@fabpot just submitted a pull request :-)

@sstok
Copy link
Contributor

sstok commented Mar 21, 2015

#13969 is closed because implementing this properly would require a bundle location resolver.
And that in turn will require to much BC breakage.

I can think of only way to improve the DX, update the exception message.

'Make sure the "%s" bundle is correctly registered and loaded in the application kernel class. If the bundle is registered, make sure that directory "%s" exists in the bundle.'

The directory name is easily extractable, the full path is not.
But will help with newcomers with looking further :)

@lmammino
Copy link
Author

I think @sstok proposal is good enough to solve the issue right now 😉

@cordoval
Copy link
Contributor

ping @javiereguiluz is this the wrong PR, or any chance, maybe i should just close it?

fabpot added a commit that referenced this issue Apr 18, 2015
…ng resource (cordoval)

This PR was merged into the 2.3 branch.

Discussion
----------

[Config][DX] improve file loader error message for missing resource

|Q            |A     |
|---          |---   |
|Bug Fix?     |y     |
|New Feature? |n     |
|BC Breaks?   |n     |
|Deprecations?|n     |
|Tests Pass?  |y     |
|Fixed Tickets|#11958|
|License      |MIT   |
|Doc PR       |      |

Commits
-------

a2deb61 [DX] improve file loader error for router/other resources in bundle
@fabpot fabpot closed this as completed Apr 18, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Config 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

9 participants