summaryrefslogtreecommitdiffstats
path: root/src/lib/cc/command_interpreter.cc
diff options
context:
space:
mode:
authorAndrei Pavel <andrei@isc.org>2023-04-05 15:10:24 +0200
committerAndrei Pavel <andrei@isc.org>2023-04-19 22:56:01 +0200
commitafc1d932798562d1bb2a6304da8733023c015268 (patch)
treec7e4cbe4ac070351b15c9548a7c6be584c8f67da /src/lib/cc/command_interpreter.cc
parent[#549] not strictly related: return enum from Element::getType() (diff)
downloadkea-afc1d932798562d1bb2a6304da8733023c015268.tar.xz
kea-afc1d932798562d1bb2a6304da8733023c015268.zip
[#549] not strictly related: better command errors
The command errors were not very accurate. Some contained technical terms like Element which are not suited for administrators.
Diffstat (limited to '')
-rw-r--r--src/lib/cc/command_interpreter.cc14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/lib/cc/command_interpreter.cc b/src/lib/cc/command_interpreter.cc
index 4d1820b044..26574cd352 100644
--- a/src/lib/cc/command_interpreter.cc
+++ b/src/lib/cc/command_interpreter.cc
@@ -173,11 +173,12 @@ parseCommand(ConstElementPtr& arg, ConstElementPtr command) {
isc_throw(CtrlChannelError, "No command specified");
}
if (command->getType() != Element::map) {
- isc_throw(CtrlChannelError, "Invalid command Element specified, expected map");
+ isc_throw(CtrlChannelError, "invalid command: expected toplevel entry to be a map, got "
+ << Element::typeToName(command->getType()) << " instead");
}
if (!command->contains(CONTROL_COMMAND)) {
isc_throw(CtrlChannelError,
- "Invalid answer specified, does not contain mandatory 'command'");
+ "invalid command: does not contain mandatory '" << CONTROL_COMMAND << "'");
}
// Make sure that all specified parameters are supported.
@@ -187,15 +188,16 @@ parseCommand(ConstElementPtr& arg, ConstElementPtr command) {
(param.first != CONTROL_ARGUMENTS) &&
(param.first != CONTROL_SERVICE) &&
(param.first != CONTROL_REMOTE_ADDRESS)) {
- isc_throw(CtrlChannelError, "Received command contains unsupported "
- "parameter '" << param.first << "'");
+ isc_throw(CtrlChannelError,
+ "invalid command: unsupported parameter '" << param.first << "'");
}
}
ConstElementPtr cmd = command->get(CONTROL_COMMAND);
if (cmd->getType() != Element::string) {
- isc_throw(CtrlChannelError,
- "'command' element in command message is not a string");
+ isc_throw(CtrlChannelError, "invalid command: expected '"
+ << CONTROL_COMMAND << "' to be a string, got "
+ << Element::typeToName(command->getType()) << " instead");
}
arg = command->get(CONTROL_ARGUMENTS);