PEAR_Error setters
| From: | Cipriano Groenendal | Date: | Sun, 18 Apr 2004 13:24:49 +0000 |
| Subject: | PEAR_Error setters | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-27911@lists.php.net to get a copy of this message | ||
Hello group.
A project I'm currently working on uses the File class, which returns
PEAR_Errors. However, none of these errors return an error code, which means
that I can't transparantly pass these along to the end user. I considered
checking for these, and if so doing my own raiseError(), untill I realised
that removes, ofcourse, all the data on the current error such as
backtraces, and File's errors.
So, I figured I'd just set my own code's on the object returned by the
File:: package, but upon searching the Pear_error class, I found no
set()ters at all. Only a constructor, and several get()ters.
What would be the best way to proceed from here? I'm considering hard
manipulation of the object returned($retval->code = MY_ERROR_CODE), but this
is bad OO practise. I could also propose a patch for either File to include
errors, or for pear_error to include setters, but both of these would raise
the dependancies for my package to the most recent, unreleased versions, of
those packages. As such, I'm leaning heavily towards the hard modification
of pear_error-objects, to limit the end user in as little ways as possible
:)
Any advise would be welcome here :)
Cipri