http curl request error handling and a bit better logging