Recently I had an error with a name being used in a helpers file. Because the template name being used was not valid, all my global helpers stopped working (Template.registerHelper()). In the past I have faced similar circumstances where one naming error causes my entire web app to crash.
Is there a way to handle error so that it does not affect other JS files?
The error was
Uncaught TypeError: Cannot read property ‘helpers’ of undefined.
Basically i’m asking how can I prevent my WHOLE app from breaking when one js file is erroring.
Don’t make errors ;). Joking aside, isn’t it kind of convenient seeing immediately where stuff breaks? I don’t think what you are looking for is possible right now but I can imagine this might be possible with some new 1.3 features (imports, exports?).
I guess you could look at it as kind of convenient in that it forces you to fix your error on the spot but it would be nice to be able to deal with the error later.
And leave your app in a possibly inconsistent state? Naw, bad idea.
I mean, you already have to deal with bugs and you want to add potentially broken stuff to it? That’s just asking for trouble.
Besides, we never ever say we’ll fix that later. You won’t fix it later ;). Only once you’ve collected a pile of crappy code to the point where it’s unbearable