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
Tracking: Better Error Messages #7481
Comments
Some general questions:
|
Good question. @IgorMinar may have an opinion. In AngularJS we had a utility function which could verify a type of an argument and then provide a useful error message. I think something like that may be needed here as well.
In prod build we could then just make these noops and inline them. What do you think? |
Seems reasonable |
I like the
I don't know which of "print a warning" or "throw an error" makes the most sense. Some example errors:
|
I think the best course of action would be to add some dev mode checks in the template compiler. Using component metadata and the template AST, we could check for cases where a query is used in a template:
Here we can give a slightly better error: I need some time with @tbosch to be sure that we can do this with his latest compiler changes. I suspect we can expand these sort of errors to other common cases to provide better feedback than the generic change detection error. |
So it sounds like this one will have to wait until @tbosch lands his change? Sounds reasonable. |
wrt assertString it sounds like we are reinventing AtScript all over again if only Typescript had runtime (type) assertions... On Thu, Mar 10, 2016 at 8:14 PM Miško Hevery notifications@github.com
|
I'd like that too. But for now I think we get good bang for our buck adding the assertions ourselves for high traffic areas where we currently throw errors like |
I agree. On Fri, Mar 11, 2016 at 12:33 PM Brian Ford notifications@github.com
|
Part of angular#7481 (effort to improve error messages)
Part of angular#7481 (effort to improve error messages)
Error Message: Cause: I forgot to add a method to be called from a click event: |
May I add to make this error better See this SO question. |
|
Part of angular#7481 (effort to improve error messages)
@robwormald there is an issue for that error #3754 mentioned in #7481 (comment) |
for missing closing tag |
Part of angular#7481 (effort to improve error messages) Closes angular#7559
when 2 routes have the same path |
multiple structural directives on the same element should produce an error message #8438 |
While there are more work to be done on better error messages, we will be closing this issue in favor of other issues. |
@mhevery I noticed this wasn't closed but it seems the interest in improving A2's error messages has waned. I feel like that would be a mistake. Right now error messages are pretty much my biggest complaint about this framework. First, even something as simple as an error thrown from the constructor of a Component logs 8 different messages to the console. Most of them redundant or unimportant information. If this is supposed to be used for debugging the framework, then they should at a minimum be disabled by default. Second, there is no way to see original source locations with Angular 2 error messages at the moment. See #11722 for more details and my attempts to debug the issue. While this is possibly an issue for the Chrome devtools team, since this primarily affects the Angular 2 development experience I feel it is relevant here. Finally, error message handling is inconsistent depending on circumstances and where errors happen. For example, you will get different results handled by different mechanisms if the error is thrown during the construction of the module during bootstrapping vs construction of a component. Another result if an error is thrown by a downgraded angular 2 component. Different handler levels all fire and in some cases rethrow to other handler levels which appears to be the cause of all the redundant logging as well. I'd like to know what, if anything, the Angular team has planned around improving errors and the debugging experience overall, because at the moment it seems to be very hard to work with. Perhaps I'm the only one experiencing these problems, or perhaps I'm just doing it wrong, in which case I'd like to hear what is the right way forward. |
@chrisnicola error messages are still very important. The right / best way forward is to open small / focused issues with a minimal reproduce scenario each time you encounter a confusing error message. Unfortunately there are way to many issues that are either lacking reproduce scenario or are taken from large apps where many different factors might be at play. In short: we want and would fix cases we can see. Once again, let's have a small, separate issue for each case. |
@pkozlowski-opensource of course, completely makes sense. So should this issue be closed then? I've opened #11722 to address the specific issue of original source locations not working with stack traces, which seems to have been prematurely closed. I'm also happy to open another to address the issue of multiple redundant error messages and/or more flexibility for developers to customize/control error reporting behaviour. |
Reopened.
Sure, but please, search for duplicates first. |
Opened #15402 for |
Closing as obsolete. Recent versions of Angular has more descriptive error messages and codes |
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. |
Issues
Other Links
The text was updated successfully, but these errors were encountered: