poke-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2] Make error handling of public API consistent


From: Jose E. Marchesi
Subject: Re: [PATCH v2] Make error handling of public API consistent
Date: Wed, 11 Nov 2020 13:25:36 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

>> >> >  pk_ios
>> >> >  pk_ios_cur (pk_compiler pkc)
>> >> >  {
>> >> > +  pkc->status = PK_OK;
>> >> >    return (pk_ios) ios_cur ();
>> >> >  }
>> >> 
>> >> Can't ios_cur fail?
>> >> 
>> >> >  pk_ios
>> >> >  pk_ios_search (pk_compiler pkc, const char *handler)
>> >> >  {
>> >> > +  pkc->status = PK_OK;
>> >> >    /* XXX use pkc */
>> >> >    return (pk_ios) ios_search (handler);
>> >> >  }
>> >> 
>> >> Ditto for ios_search.  Can't it fail?  What if an IOS having hte given
>> >> handler cannot be found?
>> >> 
>> >> > @@ -413,6 +433,7 @@ pk_ios_search (pk_compiler pkc, const char *handler)
>> >> >  pk_ios
>> >> >  pk_ios_search_by_id (pk_compiler pkc, int id)
>> >> >  {
>> >> > +  pkc->status = PK_OK;
>> >> >    /* XXX use pkc */
>> >> >    return (pk_ios) ios_search_by_id (id);
>> >> >  }
>> >> 
>> >> Likewise.
>> >> 
>> >
>> >
>> > All `ios_cur`, `ios_search` and `ios_search_by_id` functions will return 
>> > `NULL`
>> > when the entry does not exist.
>> > I don't think that's a failure or error. Everything in the library worked
>> > as expected and not found the requested item.
>> 
>> Oh, of course.
>> We have to return PK_IOS_INVALID in that case, and set status to PK_OK.
>> 
>
> Do you mean we have to return `NULL`?
> Or ...

Hm yes,  return NULL and set pk_errno to PK_OK.
Your code was right, sorry for the noise :)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]