Re: [PATCH v3 09/18] gweb: Adopt optional, immutable GError instance for GWeb result errors.

Grant Erickson <[email protected]> Mon, 24 Mar 2025 22:01:31 -0700
Newsgroups dev.linux.lists.connman
Message-ID <[email protected]>
On Mar 24, 2025, at 3:28 PM, Denis Kenzior <[email protected]> wrote:
> On 3/20/25 6:39 PM, Grant Erickson wrote:
>> In the following instances, GWeb can fail before initiating or while
>> processing a web request:
>>   1. TCP connection timeout to the remote server peer.
>>   2. Decoding a chunked response.
>>   3. Non-successful events (that is, G_IO_NVAL, G_IO_ERR, or G_IO_HUP)
>>      from 'g_io_add_watch'.
>>   4. GResolve "host not found" DNS forward resolution failure.
>>   5. Transport creation failure from 'create_transport'.
>> Rather than trying to overload 'GWEB_HTTP_STATUS_CODE_' error
>> enumerations from actual web server responses for these non-response
>> or response-in-progress failures, the signature of 'GWebResultFunc' is
>> amended to take an optional pointer to an immutable GError instance
>> which describes one of the five errors above on a GWeb request
>> failure.
> 
> This looks so much better, a few nits:

Thanks.

> Could you use:
> 
> g_autoptr(GError) local_error = NULL;

Great feedback and optimization. I was familiar with g_autofree but not g_autoptr.

I’ve adopted this across the board, as well as g_error_new, where appropriate.

Best,

Grant

-- 
Principal
Nuovations

[email protected]
https://www.nuovations.com/