NYCPHP Meetup

NYPHP.org

[nycphp-talk] Setting a catch dynamically

Michael B Allen ioplex at gmail.com
Fri Dec 14 17:46:01 EST 2007


On 12/14/07, Ben Sgro <ben at projectskyline.com> wrote:
> I want to set the customException dynamically.
>
> I tried doing so by passing it in as a var ... catch ($var $e)
>
> but that didn't seem to work.
>
> Can it be done?

No. But you do know that you can catch multiple different exceptions
at the same time right?

try {
   // do something
} catch (MyCustomException $mce) {
   // handle this type of exception here
} catch (SomeOtherException $soe) {
   // Only SomeOtherException exceptions will be caught here
} catch (Exception $e) {
   // All other types of exceptions will be caught here
}

Mike

-- 
Michael B Allen
PHP Active Directory SPNEGO SSO
http://www.ioplex.com/



More information about the talk mailing list