Subscribe on changes!

error handling changed, didn't see it in docs

avatar
Oct 18th 2020

Version

3.0.1

Reproduction link

https://jsfiddle.net/42st5Lbw/1/

Steps to reproduce

let tag = {internal_name: 'tom'} {{tag.translations[0].translation || tag.internal_name}}

What is expected?

tom

What is actually happening?

Uncaught TypeError: Cannot read property 'translations' of undefined


In vue 2 it would try everything if it has ||, now it throws error

avatar
Oct 19th 2020

In vue 2 it would try everything if it has ||, now it throws error

That's simply not the case. Your javascript expression tag.translations[0].translation will throw that error in Vue 2 and Vue 3. || is just the OR operator, not a magic error handler.