All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: "Daniel P. Berrangé" <berrange@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [PATCH 2/2] authz-list-file: Improve an error message
Date: Fri, 13 Nov 2020 13:54:22 +0100	[thread overview]
Message-ID: <87y2j5fmdd.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <20201113093648.GA30434@redhat.com> ("Daniel P. Berrangé"'s message of "Fri, 13 Nov 2020 09:36:48 +0000")

Daniel P. Berrangé <berrange@redhat.com> writes:

> On Fri, Nov 13, 2020 at 07:23:58AM +0100, Markus Armbruster wrote:
>> When qauthz_list_file_load() rejects JSON values other than JSON
>> object with a rather confusing error message:
>> 
>>     $ echo 1 | qemu-system-x86_64 -nodefaults -S -display none  -object authz-list-file,id=authz0,filename=/dev/stdin
>>     qemu-system-x86_64: -object authz-list-file,id=authz0,filename=/dev/stdin: Invalid parameter type for 'obj', expected: dict
>> 
>> Improve to
>> 
>>     qemu-system-x86_64: -object authz-list-file,id=authz0,filename=/dev/stdin: File '/dev/stdin' must contain a JSON object
>> 
>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
>> ---
>>  authz/listfile.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>

Thanks!

>> diff --git a/authz/listfile.c b/authz/listfile.c
>> index 1421e674a4..da3a0e69a2 100644
>> --- a/authz/listfile.c
>> +++ b/authz/listfile.c
>> @@ -73,7 +73,8 @@ qauthz_list_file_load(QAuthZListFile *fauthz, Error **errp)
>>  
>>      pdict = qobject_to(QDict, obj);
>>      if (!pdict) {
>> -        error_setg(errp, QERR_INVALID_PARAMETER_TYPE, "obj", "dict");
>> +        error_setg(errp, "File '%s' must contain a JSON object",
>> +                   fauthz->filename);
>
> This code pattern was copied from other places in QEMU which use the
> same QERR_INVALID_PARAMETER_TYPE. There are another 10 or so examples
> of this error message pattern.

Yes.  My "[PATCH 00/10] Chipping away at qerror.h" fixes other patterns,
but not this one.  I intend to chip some more, as time permits.



      reply	other threads:[~2020-11-13 12:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-13  6:23 [PATCH 0/2] authz-list-file: Error handling fixes Markus Armbruster
2020-11-13  6:23 ` [PATCH 1/2] authz-list-file: Fix file read error handling Markus Armbruster
2020-11-13  9:37   ` Daniel P. Berrangé
2020-11-13  6:23 ` [PATCH 2/2] authz-list-file: Improve an error message Markus Armbruster
2020-11-13  9:36   ` Daniel P. Berrangé
2020-11-13 12:54     ` Markus Armbruster [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y2j5fmdd.fsf@dusky.pond.sub.org \
    --to=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.