mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 23:33:54 -06:00
hmp: Allow for error message hints on HMP
Commits7216ae3d
andd2828429
disabled some error message hints, all because a change to use modern error reporting meant that the hint would be output prior to the actual error. Fix this by making hints a first-class member of Error. For example, we are now back to the pleasant: $ qemu-system-x86_64 --nodefaults -S --vnc :0 --chardev null,id=, qemu-system-x86_64: --chardev null,id=,: Parameter 'id' expects an identifier Identifiers consist of letters, digits, '-', '.', '_', starting with a letter. Signed-off-by: Eric Blake <eblake@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Message-Id: <1441901956-21991-1-git-send-email-eblake@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
parent
615cf669b5
commit
50b7b000c9
4 changed files with 57 additions and 35 deletions
|
@ -205,10 +205,8 @@ void parse_option_size(const char *name, const char *value,
|
|||
break;
|
||||
default:
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, name, "a size");
|
||||
#if 0 /* conversion from qerror_report() to error_set() broke this: */
|
||||
error_printf_unless_qmp("You may use k, M, G or T suffixes for "
|
||||
"kilobytes, megabytes, gigabytes and terabytes.\n");
|
||||
#endif
|
||||
error_append_hint(errp, "You may use k, M, G or T suffixes for "
|
||||
"kilobytes, megabytes, gigabytes and terabytes.");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
|
@ -648,9 +646,8 @@ QemuOpts *qemu_opts_create(QemuOptsList *list, const char *id,
|
|||
if (!id_wellformed(id)) {
|
||||
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "id",
|
||||
"an identifier");
|
||||
#if 0 /* conversion from qerror_report() to error_set() broke this: */
|
||||
error_printf_unless_qmp("Identifiers consist of letters, digits, '-', '.', '_', starting with a letter.\n");
|
||||
#endif
|
||||
error_append_hint(errp, "Identifiers consist of letters, digits, "
|
||||
"'-', '.', '_', starting with a letter.");
|
||||
return NULL;
|
||||
}
|
||||
opts = qemu_opts_find(list, id);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue