Added correct exception handling for HTTP session