Send response on error conditions in API request

pull/1318/head
Stephen Shelton 4 years ago
parent b037cf0ae4
commit 83d337ddfd
No known key found for this signature in database
GPG Key ID: EE4BADACCE8B631C

@ -257,7 +257,11 @@ namespace llarp
{
RouterID id;
if (not id.FromString(routerIdString))
throw std::invalid_argument(stringify("Invalid router id: ", routerIdString));
{
LogWarn("lokid sent us an invalid router id: ", routerIdString);
msg.send_reply("Invalid router id");
return;
}
routerIds.push_back(std::move(id));
}
@ -276,7 +280,7 @@ namespace llarp
catch (const std::exception& e)
{
LogError("Failed to handle get_peer_stats request: ", e.what());
// TODO: reply with explicit rejection to make lokid's life easier
msg.send_reply("server error");
}
}

Loading…
Cancel
Save