-
Notifications
You must be signed in to change notification settings - Fork 27.4k
angular cannot read property '1' of null is not a useful error message. #10875
Comments
can you create a plunker tat shows the error? without this there is not a lot that can be done |
betting this is coming from https://github.com/angular/angular.js/blob/master/src/ng/parse.js#L920 |
I think it was caused by the following syntax error on a div tag |
angular isn't the one parsing the DOM, that's your web browser. |
Why is the error message generated in the angular call stack? |
TypeError: Cannot read property '1' of null |
Betting on this https://github.com/angular/bower-angular/blob/ecf0435da949836c63ebf048ea8b7710542e33ce/angular.js#L8414-L8416 --- however there's still no way we'd be able to be like "hey your html is screwed up on this line and this column", that's not feasible |
The relevant materials to repro are as follows add the following to index.html ` `Add the following to the top level module: Add the following to signup-section.html
|
it's pretty clear what the problem is, but we still can't really say where the error happened in your code, we have no way of knowing. best we can do is say "hey, you screwed up your controller name somewhere" |
Here is the code where the exception gets thrown:
It fails on constructor=match[1] You are not testing for a proper match here by the way and you are tossing an error way up the stack. The input to the function contains the following value in expression:
So rather than punting the exception up the stack if you were to do something about catching the exeption in match, then wrapping it with contextual information provided by the value of expression you could make the error a thousand times more informative. |
Previously, the error was a JS runtime error when trying to access a property of `null`. But, it's a bit nicer to throw a real error and provide a description of how to fix it. Developer ergonomics and all that. Closes angular#10875
What does this error even mean. Error message is not actionable.
The text was updated successfully, but these errors were encountered: