(re)throwing exceptions

php.internals

Dennis Sterzenbach

21 years ago
Hi Folks! What do you think about re-throwing an Exception? I think of a situation when writing a complex framework and one call on a lower hierachy level throws an Exception, the higher levels should be able to get to know. If I have to catch it on a higher level, I can't leave the caught Exception as is just adding my current context to the stack trace. Sometimes you need something like that. VB.NET for example allows you something like: Public Sub foo() Try ... Catch e AS NastyException ... throw End Try End Sub Best Regards Dennis Sterzenbach

Antony Dovgal

21 years ago
On Sat, 06 Aug 2005 17:19:35 +0200 Dennis Sterzenbach <lists@darknoise.de> wrote:
> Hi Folks! > > What do you think about re-throwing an Exception? > I think of a situation when writing a complex framework > and one call on a lower hierachy level throws an Exception, > the higher levels should be able to get to know. > If I have to catch it on a higher level, I can't leave the > caught Exception as is just adding my current context to the > stack trace.
<?php try { /* do something here */ } catch (Exception $e) { throw $e; } ?> Is it what you need?
-- Wbr, Antony Dovgal

Dennis Sterzenbach

21 years ago
Antony Dovgal wrote:
> try { > /* do something here */ > } catch (Exception $e) { > throw $e; > } > > ?> > > Is it what you need?
Whooops! Big sorry guys, my fault. Thanks to you Antony. Dennis