throw instead of exit
This commit is contained in:
parent
99ecd586d4
commit
91fce00df3
|
|
@ -114,8 +114,7 @@ HttpClient::doGetRequest(const std::string &url, const std::unordered_map<std::s
|
|||
std::string HttpClient::inetAddress(std::string hostname) {
|
||||
hostent *record = gethostbyname(hostname.c_str());
|
||||
if (record == NULL) {
|
||||
std::cerr << hostname << " is unavailable" << std::endl;
|
||||
exit(1);
|
||||
throw std::runtime_error(hostname + " network unavailable.");
|
||||
}
|
||||
in_addr *address = (in_addr *) record->h_addr;
|
||||
std::string ip_address = inet_ntoa(*address);
|
||||
|
|
|
|||
Loading…
Reference in New Issue