|
From: | Eric Blake |
Subject: | Re: [Qemu-devel] [PATCH v2] numa: clarify error message when node index is out of range in -numa dist, ... |
Date: | Wed, 16 May 2018 09:46:33 -0500 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 |
On 05/16/2018 09:32 AM, Igor Mammedov wrote:
Actually, error_setg() is documented as taking a single phrase (no '.' included), and that if you need a second sentence, it's better to use error_append_hint().well, using append_hint makes it less readable, before using it we get following error: $ qemu-system-x86_64 -numa dist,src=128,dst=1,val=20 qemu-system-x86_64: -numa dist,src=128,dst=1,val=20: Invalid node 128, The valid node range is [0 - 127] $ after using it we get:$ qemu-system-x86_64 -numa dist,src=128,dst=1,val=20qemu-system-x86_64: -numa dist,src=128,dst=1,val=20: Invalid node value 128 The valid node range is [0 - 127]$ i.e. an extra newline in the middle of error message and looses automatic newline at the end so the shell prompt continues error message
Use of error_append_hint() requires you to provide a newline (unlike error_setg(). But as Markus pointed out, you don't need to use it:
Correct. Providing help on valid values is exactly what error_append_hint() is for.Maybe Markus has an opinion on the best way to word this error message.Yes: "Parameter 'src' expects an integer between 0 and 127"
I like this wording better, which avoids the shortfalls that error_append_hint() would introduce.
-- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
[Prev in Thread] | Current Thread | [Next in Thread] |