Catching errors in chrome extension and making it generally more robust