Better error message for undefined bound property
See original GitHub issueGiven the following:
<button :value.sync="missing">click</button>
results in the following error in the Chrome console:
Uncaught TypeError: Cannot read property 'length' of undefined
There is no mention:
- that a bound property is missing
- that its name is ‘missing’
- that it’s on an element
<button>
- that it come from file
foo.vue
An improvement would be to say:
Error: bound object 'missing' on element``<button>``can't be found
in file foo.vue
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
How to Prevent the Error: Cannot Read Property '0' of Undefined
A guide on how to prevent the error "cannot Read Property '0' of Undefined", covering techniques such as try, catch, using const over...
Read more >Uncaught TypeError: Cannot read property 'bind' of undefined ...
Uncaught TypeError: Cannot read property 'bind' of undefined, but I have bound the method and it is not undefined in the console.
Read more >7 Tips to Handle undefined in JavaScript - Dmitri Pavlutin
A detailed article about 'undefined' keyword in JavaScript. 7 tips on how to handle correctly 'undefined' and increase code durability.
Read more >How to Avoid Getting 'Cannot read property of undefined' in ...
Learn how you can avoid getting the famous 'Cannot read property of undefined' error in JavaScript with the logical OR operator.
Read more >ERROR [app-router] TypeError: Cannot read property ... - GitHub
When I use @bindable to bind an array of strings in my custom ... TypeError: Cannot read property 'subscriberAdded' of undefined I've traced ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
its also an issue when accessing sub properties of non-existing properties.
e.g.
{{options.title}}
where options is not yet defined. IMHO it would be better to follow the angular way and just resolve string interpolations with errors to empty string and only log this error in non-release modeSimilarly, this error could be more useful if it showed which component was trying to reference this element.
thanks for the awesome project!!