Re: Reclassifying some PHP functions warning as exceptions

From: Date: Thu, 24 Oct 2019 16:31:45 +0000
Subject: Re: Reclassifying some PHP functions warning as exceptions
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-107660@lists.php.net to get a copy of this message
On Thu, 24 Oct 2019 at 16:38, Mike Schinkel <mike@newclarity.net> wrote: > > Here, try() would swallow only FileException, other exceptions are still > > thrown. I'm not sure if this construct is worth introducing though, the > > difference compared to a proper try / catch is much smaller. > > I would want it to capture every exception. Why not? Because you might want to convert "FileLockedByAnotherProcessException" to a locally-handled error, but allow "ServerIsOnFireException" to bubble up to a higher-level exception handler. That's why catch blocks basically force you to specify class/interface names: you should catch only the exceptions you actually know how to handle in that particular piece of code. Regards, -- Rowan Tommins [IMSoP]

« previous php.internals (#107660) next »