[Yum-devel] returnNewestByName & PackageSackError's ...
Panu Matilainen
pmatilai at laiskiainen.org
Thu Jun 1 07:04:54 UTC 2006
On Wed, 31 May 2006, Bret McMillan wrote:
> On Wed, 2006-05-31 at 15:49 -0400, seth vidal wrote:
>
>>> _computeAggregate* are really generic; dealing with exceptions for
>>> anything non-critical seems impractical... what am I missing? Just
>>> seems like returnNewestBy* should be able to return None if there wasn't
>>> any match; it doesn't seem to warrant an exception.
>>
>> I guess I don't understand what the big deal is about catching the
>> exceptions in _computerAggregate*.
>>
>> why not just enclose the call in a try, except?
>>
>> what's the expense?
>
> No expense, I question the utility. Since _computeAggregate* calls out
> to any number of functions on the internal sacks, how can it
> meaningfully respond to a generic PackageSackError?
Exception handling isn't exactly free either.
> So, the options are either:
> a) skip all PackageSackErrors (ick)
> b) create a more specific exception, say PackageNotFound, and look
> specifically for that in _computeAggregate* and skip it
> c) just return None.
d) What I'd prefer is instead of None, return [] so you don't need
check if it was None or a list and handle specially. IIRC a a couple of
years ago in rpm python bindings an interface was changed from return
empty list instead of None because everybody hated the special casing None
caused :)
> If you expect to always return a result from returnNewestBy*, raising an
> exception is sane. But with the repos I'm working with, seems like a
> pretty frequent occurrence during depsolving to not have the pkg in one
> or more sacks.
>
> I guess the question I have is, where is raising this exception useful?
> I didn't see anything looking specifically to catch PackageSack errors
> yet, is something in the works?
Package not found in a given repository isn't an exceptional situation in
my opinion either.
- Panu -
More information about the Yum-devel
mailing list