Added exception handling for HTTP error response