Add exception handling for http requests.