add error handlers array and event listeners

the array of error handler functions are looped over and invoked with the
uncaught exception or user trigger error event error.