better error handling for http transport