[dev] Re: [cvs] commit: turba/lib Driver.php sam/lib Driver.php orator/lib Slide.php odin/lib Driver.php LogParser.php moment/lib View.php mnemo/lib Driver.php kronolith/lib Driver.php klutz/lib Driver.php ingo/lib Script.php

Jan Schneider jan at horde.org
Tue Apr 29 12:01:48 PDT 2003


Zitat von Chuck Hagenbuch <chuck at horde.org>:

> Quoting Jan Schneider <jan at horde.org>:
>
> > We are still very inconsistent how we handle failing factory methods.
>
> There's some method to this, actually.
>
> > We return a PEAR_Error (mostly in the Horde libs), false or call
> > Horde::fatal().
> >
> > We should agree on one way to handle this and fix all factory methods
> > that don't follow this scheme.
>
> Well, the thing is whether or not failure is fatal, or whether it can be
> handled gracefully somehow. If something like the registry fails, we
> should
> really just bail out. If it's something we can live without, or just
> inform
> the user that it didn't work - like a Turba source - then we should
> return
> *and* handle an error.

Ok, I think it might not always be easy to decide if an error is fatal, but
it makes sense. Though IIRC Turba (as all other Driver APIs) exits fatally
if one of the configuration parameters is missing but not if an error
occured during the initialization of the driver.

What I think we could agree on is to always return at least a PEAR_Error if
something fails. Just returning false isn't very helpful when trying to
track why something isn't working.
In return each call to factory methods needs to check for such an error
then.

Jan.

--
http://www.horde.org - The Horde Project
http://www.ammma.de - discover your knowledge
http://www.tip4all.de - Deine private Tippgemeinschaft


More information about the dev mailing list