The AngularJS $exceptionHandler service allows you to catch and handle unanticipated JavaScript errors in a meaningful way.