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
Unhelpful error message when Component is missing a selector #3464
Comments
Related to #2336. |
Question: How should we reference "SourdoughBreadcrumbs" in the error message? I imagine we would normally use the component selector however in this example it doesn't exist, right? A generic error message might look like... annotations_impl/annotations.ts !isString(selector) ? throw makeTypeError('The component annotation requires a string selector'): null; Give me your thoughts and I'll create a pull request and make some tests. |
@danielrasmuson we had some conversation about it in #3533 and it looks like TypeScript tape checking should take care of this for people using TS. @mhevery I guess we still need a check inside ng2 for people using ES6 / ES5, right? If so I would be more happy to help out @danielrasmuson to prepare a PR |
Sure @danielrasmuson can send a PR. |
@pkozlowski-opensource I've started working on this but I have a few questions.
|
@danielrasmuson empty, invalid or omitted selectors should throw. I would start simply and verify just those, we can add more checks (eg. special chars) later on. |
…component annotation if the component selector is an empty string, not a string, or not supplied an error will be thrown Closes angular#3464
Doesn't that conflict with: #1662 ? |
@PascalPrecht @danielrasmuson yeh, thinking about it some more, I think that throwing in The other case I can think of where an empty selector in |
…component annotation If the component selector is an empty string or not a string an error will be thrown. Closes angular#3464
…component annotation If the component selector is an empty string or not a string an error will be thrown. Closes angular#3464
…component annotation If the component selector is an empty string or not a string an error will be thrown. Closes angular#3464
…component annotation If the component selector is an empty string or not a string an error will be thrown. Closes angular#3464
…component annotation If the component selector is an empty string or not a string an error will be thrown. Closes angular#3464
…component annotation If the component selector is an empty string or not a string an error will be thrown. Closes angular#3464
…component annotation If the component selector is an empty string or not a string an error will be thrown. Closes angular#3464
…component annotation If the component selector is an empty string or not a string an error will be thrown. Closes angular#3464
@pkozlowski-opensource I've updated my pr with your feedback. It's only a couple lines. Your thoughts? #3759 |
…component annotation If the component selector is an empty string or not a string an error will be thrown. Closes angular#3464
There is some problem with selector validation: Failed to execute 'querySelector' on 'Document': 'div[foo=123]' is not a valid selector. It fails only if attribute value is int. String value is fine:
Check on alpha44 |
…component annotation If the component selector is an empty string or not a string an error will be thrown. Closes angular#3464 Closes angular#3759
…component annotation If the component selector is an empty string or not a string an error will be thrown. Closes angular#3464
…component annotation If the component selector is an empty string or not a string an error will be thrown. Closes angular#3464
Components without a selector now get the selector `ng-component`. Directives without a selector will throw an error message. Closes angular#3464 Closes angular#10216
Components without a selector now get the selector `ng-component`. Directives without a selector will throw an error message. Closes angular#3464 Closes angular#10216
Components without a selector now get the selector `ng-component`. Directives without a selector will throw an error message. Closes angular#3464 Closes angular#10216
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
If you omit selector completely for a
Component
, you getIf you use an empty string as a selector, you get an error in
view_manager.js
Both of these cases should be captured by a single check that tells the user something like
The text was updated successfully, but these errors were encountered: