Re: Re: [PEPr] Changes in proposal for File Formats::File_Fortune
| From: | Matthew Weier O'Phinney | Date: | Fri, 01 Jul 2005 16:20:23 +0000 |
| Subject: | Re: Re: [PEPr] Changes in proposal for File Formats::File_Fortune | ||
| References: | 1 2 3 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-38415@lists.php.net to get a copy of this message | ||
On 7/1/05, Sérgio Carvalho <sergio.carvalho@portugalmail.net> wrote:
> Matthew Weier O'Phinney wrote:
> > Matthew Weier O'Phinney (http://pear.php.net/user/weierophinney) has edited
> > the proposal for File Formats::File_Fortune.
> >
> > Change comment:
> >
> > I've reverted to a PHP5-only version. Additionally, I have moved the bulk
> > of the package-level documentation blocks to the class-level docblocks as
> > they contain information on class usage (this allows this info to show up
> > in the generated documentation).
> >
> > I have moved the error constants into the classes themselves, which also
> > allowed me to strip the classname prefix; all thrown errors were modified
> > to utilize the new class constants.
> >
> > Please review the proposal:
> > http://pear.php.net/pepr/pepr-proposal-show.php?id=263
>
> For a PHP5-only package, you should use exceptions, not return-value
> errors. That is not to say you should drop error constants, but for PHP5
> Exceptions are the error returning method agreed upon:
>
> Guidelines are here:
> http://pear.php.net/pepr/pepr-proposal-show.php?id=132
I've read the document, and have some questions on how to proceed.
Should the exception classes utilized by the package be within the same file as
the class throwing them, or in their own file and/or individual files? And what
is suitable for an exception class definition? For example, would the following
be enough:
require_once 'PEAR/Exception.php';
class File_Fortune_Exception extends PEAR_Exception
{
}
Or would this be where the error constants should come into play (i.e., to map
errors to messages)?
A link to a package that makes good use of PEAR_Exception would help.
Thanks!
--
Matthew Weier O'Phinney
mweierophinney@gmail.com
http://weierophinney.net/matthew/