Hacker News new | past | comments | ask | show | jobs | submit login

> I think (but can be wrong) that by using such a dynamic environment like JS is the culprit for lack of good error checking mechanism.

Not at all. It's perfectly possible to implement solid error handling. There's even a global handler: https://developer.mozilla.org/en-US/docs/Web/API/GlobalEvent....

For legacy scenarios (IE11) you can add an event handler for the error event, so you end up with something like the following to deal with both situations:

    window.onerror = yourErrorHandlerFunction;
    window.addEventListener('error', yourErrorEventHandlerFunction);
The shape of the objects passed in differs slightly, hence the need for two different handlers. In my case one simply repackages the object and hands it off to the other.



Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: