Re: PHP5 exception handling

From: Date: Fri, 30 Jul 2004 16:00:18 +0000
Subject: Re: PHP5 exception handling
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-192325@lists.php.net to get a copy of this message
You can check out how exceptions are handled in Java or C++ as well, they all sorta work the same, you may find more complete docs for them. Jason On 30 Jul 2004 14:58:59 -0000, Matthew Weier O'Phinney <matthew@garden.org> wrote: > I've done some reading on the ZE2 exception handling, but I'm not quite > sure I understand how it works. I'm familiar with the following in perl: > > eval { > do some stuff... > } > if ($@) { > report an exception... > } > > Which looks a lot like the following in PHP5: > try { > do some stuff... > } > catch () { > } > > The problem I'm running into: what do I pass as arguments to catch()? > The articles on ZE2 use something like: catch (Exception $e) {}, or > something like catch(MyException $e) (where MyException is a class they > defined in their examples). Is the 'Exception' class a base > class/handler with PHP5? Do I need to create my own exception handler > classes? Do I even need to catch objects of a specific type, or can I > simply do: > catch ($error) { > do something with $error > } > > Thanks in advance. > > -- > Matthew Weier O'Phinney | WEBSITES: > Webmaster and IT Specialist | http://www.garden.org > National Gardening Association | > http://www.kidsgardening.com > 802-863-5251 x156 | > http://nationalgardenmonth.org > mailto:matthew@garden.org | > http://vermontbotanical.org > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.general (#192325) next »