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

Exporting wrong object type from a Route gives a hard to debug error #11212

Closed
mitchlloyd opened this issue May 18, 2015 · 3 comments
Closed

Comments

@mitchlloyd
Copy link
Contributor

I was pairing with someone today and stupidly exported a component instead of a route from a route file. The resulting message said that there was an error loading my route:

route._stashNames is not a function

The code we were dealing with had a lot going on, so we lost time debugging before we found that we had extended the wrong Ember object.

Would it be reasonable to check that an exported route is in fact an Ember.Route and give a helpful error message? Where would be a good place to put that kind of check?

@rwjblue
Copy link
Member

rwjblue commented May 19, 2015

I think the simplest thing to do would be to implement resolveRoute in the resolver, and do some sort of brand check (adding isRoute: true) on the returned factory. Then do an assert if the check doesn't pass...

@mitchlloyd
Copy link
Contributor Author

Thanks for the info. I should be able to spend some time on this issue this week.

@rwjblue
Copy link
Member

rwjblue commented May 21, 2015

I'm going to go ahead and close this issue for now, I definitely look forward to reviewing your PR...

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