Improved handling of uncaught AJAX errors