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

Bug#170480: libapt-pkg-dev: An error API with more specific codes would be nice.



Hi,

On Sun, Nov 24, 2002 at 06:16:08PM -0600, Adam Heath wrote:
> >   Right now, apt's error API essentially tells the program
> > "an error occured somewhere, here's a human-readable description".  This
> > is a nice feature, but sometimes it would be nice to be able to
> > distinguish particular errors.  For instance, if a package list file is
> > missing, a frontend could automatically fetch new lists (or that
> > particular list) to fix the problem.

> Probably the easiest way to fix this, is to extend GlobalError::Item, to also
> have an error code.  Then, frontends can iterate the error list, and make more
> appropriate decisions.

Maybe I'm shouting "Jehova" here, but what about using exceptions?
That's specifically what they were designed for, you can have a
hierarchy of exceptions that you can extend easily, as soon as the patch
is finished you can have the compiler check the error paths, etc. The
only issue with exceptions is that some functions may need to be
restarted by the application after an exception in order to recover from
the error, but that's not a real bug in itself (in fact it's a feature:
The application can decide whether it wants to continue).

   Simon

-- 
GPG Fingerprint: 040E B5F7 84F1 4FBC CEAD  ADC6 18A0 CC8D 5706 A4B4

Attachment: pgpF5_yqgtQg1.pgp
Description: PGP signature


Reply to: