Added exception handling in the request library