Javascript: Exception and error strategy
<p>Does anybody know a good strategy for handling exceptions and errors. At the moment I have different pieces of code handling their own validation/errors/exception but I would really have a centralized strategy. I was thinking of some global notification system that passes some errors/exceptions to the user like validation. Other errors I would post to my back-end and log them.</p>

<p>For example a validation error could contain the element that caused the error. That way I can add a class to highlight it and append some text before or after. </p>

<p>So if anybody has some concrete examples on how to do this I would really appreciate it.</p>
