Cleanup error handling in ajax requests