List Info

Thread: Short question: PEAR_ERROR_EXCEPTION




Short question: PEAR_ERROR_EXCEPTION
user name
2007-07-21 09:31:31
Hi!

I'm trying to use PEAR with exceptions for error handling.
However,  
the PEAR_ERROR_EXCEPTION constant is deprecated. So, what is
right  
way of doing it?

Best regards
Christoph Schiessl

-- 
PEAR Development Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php


Re: Short question: PEAR_ERROR_EXCEPTION
user name
2007-07-21 13:44:16
Hm...

All the PEAR packages (for example MDB2) are still using  
PEAR::raiseError(). Because of that a get PHP warning
triggered by  
PEAR when an error occurs.

I suppose there's no work around for that?

On Jul 21, 2007, at 8:28 PM, Martin Jansen wrote:

> On Sat Jul 21, 2007 at 04:3131PM +0200, Christoph
Schiessl wrote:
>> I'm trying to use PEAR with exceptions for error
handling. However,
>> the PEAR_ERROR_EXCEPTION constant is deprecated.
So, what is right
>> way of doing it?
>
> Throw PEAR_Exception directly.  It is defined in
PEAR/Exception.php.
>
> - Martin

Re: Short question: PEAR_ERROR_EXCEPTION
user name
2007-07-21 13:28:30
On Sat Jul 21, 2007 at 04:3131PM +0200, Christoph Schiessl
wrote:
> I'm trying to use PEAR with exceptions for error
handling. However,  
> the PEAR_ERROR_EXCEPTION constant is deprecated. So,
what is right  
> way of doing it?

Throw PEAR_Exception directly.  It is defined in
PEAR/Exception.php.

- Martin

-- 
PEAR Development Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php


Re: Short question: PEAR_ERROR_EXCEPTION
user name
2007-07-21 13:50:33
On Sat Jul 21, 2007 at 08:4416PM +0200, Christoph Schiessl
wrote:
> All the PEAR packages (for example MDB2) are still
using  
> PEAR::raiseError(). Because of that a get PHP warning
triggered by  
> PEAR when an error occurs.

MDB2 cannot use PEAR_Exception because it is compatible to
PHP 4.x.  All
new packages for PHP 5 must however use it.  See
http://pear.php.net/pepr/pepr-proposal-show.php?id=132
for details.

> I suppose there's no work around for that?

The warning that is emitted is E_USER_WARNING.  You could
adjust your
error reporting level to suppress these.  This however is
incredibly
ugly/wrong/... and most likely not what you want.  I have
not better
suggestion unfortunately, sorry.

- Martin

-- 
PEAR Development Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php


Re: Short question: PEAR_ERROR_EXCEPTION
user name
2007-07-21 14:15:46
> All the PEAR packages (for example MDB2) are still
using  
> PEAR::raiseError(). Because of that a get PHP warning
triggered by  
> PEAR when an error occurs.
> 
> I suppose there's no work around for that?

Use the following line at the beginning of your code:
PEAR::setErrorHandling(PEAR_ERROR_EXCEPTION);


-- 
Regards/Mit freundlichen Grüßen
Christian Weiske

--
PEAR Development Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php


Re: Short question: PEAR_ERROR_EXCEPTION
user name
2007-07-21 14:20:51
On Sat Jul 21, 2007 at 09:1546PM +0200, Christian Weiske
wrote:
> > All the PEAR packages (for example MDB2) are still
using  
> > PEAR::raiseError(). Because of that a get PHP
warning triggered by  
> > PEAR when an error occurs.
> > 
> > I suppose there's no work around for that?
> 
> Use the following line at the beginning of your code:
> PEAR::setErrorHandling(PEAR_ERROR_EXCEPTION);

I suppose that he was referring to the warning that is
emitted by

  $obj = new PEAR_Error($message, $code,
PEAR_ERROR_EXCEPTION);

- Martin

-- 
PEAR Development Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php


Re: Short question: PEAR_ERROR_EXCEPTION
user name
2007-07-21 14:35:03
On 7/21/07, Martin Jansen <martindivbyzero.net> wrote:
> On Sat Jul 21, 2007 at 09:1546PM +0200, Christian
Weiske wrote:
> > > All the PEAR packages (for example MDB2) are
still using
> > > PEAR::raiseError(). Because of that a get PHP
warning triggered by
> > > PEAR when an error occurs.
> > >
> > > I suppose there's no work around for that?
> >
> > Use the following line at the beginning of your
code:
> > PEAR::setErrorHandling(PEAR_ERROR_EXCEPTION);
>
> I suppose that he was referring to the warning that is
emitted by
>
>   $obj = new PEAR_Error($message, $code,
PEAR_ERROR_EXCEPTION);

There is also one about the "isError" method being
used static. 

Till

-- 
PEAR Development Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php


Re: Short question: PEAR_ERROR_EXCEPTION
user name
2007-07-21 14:51:33
On 7/21/07, David Coallier <davidcphp.net> wrote:
> On 7/21/07, till <klimponggmail.com> wrote:
> > On 7/21/07, Martin Jansen <martindivbyzero.net> wrote:
> > > On Sat Jul 21, 2007 at 09:1546PM +0200,
Christian Weiske wrote:
> > > > > All the PEAR packages (for example
MDB2) are still using
> > > > > PEAR::raiseError(). Because of that
a get PHP warning triggered by
> > > > > PEAR when an error occurs.
> > > > >
> > > > > I suppose there's no work around
for that?
> > > >
> > > > Use the following line at the beginning
of your code:
> > > >
PEAR::setErrorHandling(PEAR_ERROR_EXCEPTION);
> > >
> > > I suppose that he was referring to the
warning that is emitted by
> > >
> > >   $obj = new PEAR_Error($message, $code,
PEAR_ERROR_EXCEPTION);
> >
> > There is also one about the "isError"
method being used static. 
> >
> > Till
> >
> > --
> > PEAR Development Mailing List (http://pear.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub
.php
> >
> >
>
> PHP4 and PHP5. 

Of course - just saying, I think this is the #1
error/warning though
which I get with older PHP4-compatible code. Aside from
that, all (of
MDB2) has worked beautifully so far for me.

Till

-- 
PEAR Development Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php


Re: Short question: PEAR_ERROR_EXCEPTION
user name
2007-07-21 14:46:15
On 7/21/07, till <klimponggmail.com> wrote:
> On 7/21/07, Martin Jansen <martindivbyzero.net> wrote:
> > On Sat Jul 21, 2007 at 09:1546PM +0200, Christian
Weiske wrote:
> > > > All the PEAR packages (for example MDB2)
are still using
> > > > PEAR::raiseError(). Because of that a
get PHP warning triggered by
> > > > PEAR when an error occurs.
> > > >
> > > > I suppose there's no work around for
that?
> > >
> > > Use the following line at the beginning of
your code:
> > >
PEAR::setErrorHandling(PEAR_ERROR_EXCEPTION);
> >
> > I suppose that he was referring to the warning
that is emitted by
> >
> >   $obj = new PEAR_Error($message, $code,
PEAR_ERROR_EXCEPTION);
>
> There is also one about the "isError" method
being used static. 
>
> Till
>
> --
> PEAR Development Mailing List (http://pear.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub
.php
>
>

PHP4 and PHP5. 

-- 
David Coallier,
Founder & Software Architect,
Agora Production (http://agoraproduction.com
)
51.42.06.70.18

-- 
PEAR Development Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php


[1-9]

about | contact  Other archives ( Real Estate discussion Medical topics )