Added exception handling for http requests