[Libguestfs] [PATCH 1/2] perl: Don't prefix error messages with command name.

Matthew Booth mbooth at redhat.com
Fri Feb 12 17:23:20 UTC 2010


On 12/02/10 16:49, Richard W.M. Jones wrote:
> On Fri, Feb 12, 2010 at 04:45:33PM +0000, Matthew Booth wrote:
>> On 12/02/10 14:43, Richard W.M. Jones wrote:
>>> >From 26a2aa2a2b4440e170c51c7ee82cba31d65b78ea Mon Sep 17 00:00:00 2001
>>> From: Richard Jones <rjones at redhat.com>
>>> Date: Fri, 12 Feb 2010 13:42:57 +0000
>>> Subject: [PATCH 1/2] perl: Don't prefix error messages with command name.
>>>
>>> The command name is already being added by the RPC stubs, so
>>> adding it again in Perl just results in doubled error messages
>>> like:
>>>   foo: foo: the error
>>> ---
>>>  src/generator.ml |   14 +++++++-------
>>>  1 files changed, 7 insertions(+), 7 deletions(-)
>>>
>>> diff --git a/src/generator.ml b/src/generator.ml
>>> index 607b6d1..b0ffc58 100755
>>> --- a/src/generator.ml
>>> +++ b/src/generator.ml
>>> @@ -8149,7 +8149,7 @@ DESTROY (g)
>>>             pr ";\n";
>>>             do_cleanups ();
>>>             pr "      if (r == -1)\n";
>>> -           pr "        croak (\"%s: %%s\", guestfs_last_error (g));\n" name;
>>> +           pr "        croak (\"%%s\", guestfs_last_error (g));\n";
>>
>> If you search for guestfs_last_error in generator.ml, it looks like
>> there are more of these. Some examples:
>>
>> 8260:
>>   do_cleanups ();
>>   pr "      if (%s == NULL)\n" n;
>>   pr "        croak (\"%s: %%s\", guestfs_last_error (g));\n" name;
>>
>> 8304:
>>   do_cleanups ();
>>   pr "      if (%s == NULL)\n" n;
>>   pr "        croak (\"%s: %%s\", guestfs_last_error (g));\n" name;
>>
>> 10314:
>>       generate_call ();
>>       pr "      if (r %s)\n" (c_error_comparison ());
>>       pr "        throw new Error (\"%s: \" + guestfs_last_error
>> (_handle));\n"
>>         name;
> 
> Oh dear, indeed there are.
> 
> Updated patch attached.

ACK.

Matt
-- 
Matthew Booth, RHCA, RHCSS
Red Hat Engineering, Virtualisation Team

M:       +44 (0)7977 267231
GPG ID:  D33C3490
GPG FPR: 3733 612D 2D05 5458 8A8A 1600 3441 EA19 D33C 3490




More information about the Libguestfs mailing list