error handling for http connections