implement error handing for HttpClient