mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
virsh: Improve error message on integer value parsing failure.
Replace more than 30 ad-hoc error messages with a single, generic one that contains the name of the option being processed and some hints to help the user understand what could have gone wrong. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1207043
This commit is contained in:
committed by
Michal Privoznik
parent
8ed0bcfd81
commit
449316701b
@@ -341,8 +341,9 @@ cmdDomMemStat(vshControl *ctl, const vshCmd *cmd)
|
||||
* This is not really an unsigned long, but it
|
||||
*/
|
||||
if ((rv = vshCommandOptInt(cmd, "period", &period)) < 0) {
|
||||
vshError(ctl, "%s",
|
||||
_("Unable to parse integer parameter."));
|
||||
vshError(ctl,
|
||||
_("Numeric value for <%s> option is malformed or out of range"),
|
||||
"period");
|
||||
goto cleanup;
|
||||
}
|
||||
if (rv > 0) {
|
||||
@@ -1439,8 +1440,9 @@ cmdDomTime(vshControl *ctl, const vshCmd *cmd)
|
||||
|
||||
if (rv < 0) {
|
||||
/* invalid integer format */
|
||||
vshError(ctl, "%s",
|
||||
_("Unable to parse integer parameter to --time."));
|
||||
vshError(ctl,
|
||||
_("Numeric value for <%s> option is malformed or out of range"),
|
||||
"time");
|
||||
goto cleanup;
|
||||
} else if (rv > 0) {
|
||||
/* valid integer to set */
|
||||
|
||||
Reference in New Issue
Block a user