dout(1) << "Can't run that command on an inactive MDS!" << dendl;
f->dump_string("error", "mds_not_active");
} else {
- handled = mds_rank->handle_asok_command(command, cmdmap, f, ss);
+ try {
+ handled = mds_rank->handle_asok_command(command, cmdmap, f, ss);
+ } catch (const bad_cmd_get& e) {
+ ss << e.what();
+ }
}
}
f->flush(ss);
r = -EINVAL;
outs = ss.str();
} else {
- r = _handle_command(cmdmap, m, &outbl, &outs, &run_after, &need_reply);
+ try {
+ r = _handle_command(cmdmap, m, &outbl, &outs, &run_after, &need_reply);
+ } catch (const bad_cmd_get& e) {
+ outs = e.what();
+ r = -EINVAL;
+ }
}
priv.reset();
r = -EINVAL;
}
else {
- bool handled = mds_rank->handle_command(cmdmap, m, &r, &ds, &ss,
- need_reply);
- if (!handled) {
- // MDSDaemon doesn't know this command
- ss << "unrecognized command! " << prefix;
- r = -EINVAL;
+ bool handled;
+ try {
+ handled = mds_rank->handle_command(cmdmap, m, &r, &ds, &ss,
+ need_reply);
+ if (!handled) {
+ // MDSDaemon doesn't know this command
+ ss << "unrecognized command! " << prefix;
+ r = -EINVAL;
+ }
+ } catch (const bad_cmd_get& e) {
+ ss << e.what();
+ r = -EINVAL;
}
}
}