Skip to content

Commit

Permalink
fix(cpp-client): Fix certain error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
kosak committed Aug 26, 2024
1 parent 329057e commit b8c25d2
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ std::string GetHostname() {
addrinfo *info;
const int r = getaddrinfo(hostname, nullptr, &hints, &info);
if (r != 0 || info == nullptr) {
throw std::runtime_error(DEEPHAVEN_LOCATION_STR("getaddrinfo failed: ") + gai_strerror(r));
auto message = fmt::format("getaddrinfo failed: {}", gai_strerror(r));
throw std::runtime_error(DEEPHAVEN_LOCATION_STR(message));
}
// Of all the alternatives, pick the longest.
std::size_t maxlen = std::strlen(info->ai_canonname);
Expand All @@ -62,9 +63,8 @@ std::string GetHostname() {
const int r = gethostname(hostname, sizeof(hostname));
if (r != 0) {
int lasterr = WSAGetLastError();
throw std::runtime_error(
DEEPHAVEN_LOCATION_STR("gethostname failed: error code ") +
std::to_string(lasterr));
auto message = fmt::format("gethostname failed: error code {}", lasterr);
throw std::runtime_error(DEEPHAVEN_LOCATION_STR(message));
}
return std::string(hostname);
#else
Expand Down

0 comments on commit b8c25d2

Please sign in to comment.