![]() |
Catching exceptions up the stack
Howdy all,
The problem I'm having is catching an exception at the top layer of a script, that is thrown from a lower level. Exceptions *should* travel all the way up the stack, looking for a catch statement, until the end of the stack is reached. But that's not working for me. Here is a code example: :
class FooEven though the exception is thrown in the Foo class, which is the third class initiated, the exception *should* bubble-up and get caught in the try...catch statement. But it doesn't. PHP will die with a uncaught exception fatal error. Actually the above code works just fine. But the code I'm working on now is basically the same, only it's a lot more code. It's an object created by an object, created by an object, created by an object, which finally has a try...catch statement. The deepest object throws the exception, and it's not bubbling-up to the try...catch statement. So is there a limit on how far up the stack PHP will go to find a try...catch clause? |
Nevermind! I really should have done more debugging before wasting everyone's time by posting a message here.
The script I'm working on runs within a larger piece of software that has an event based system. The method that's throwing the exception is being called by the larger piece of software via an event, and therefor it's not part of my script's stack, but the larger programs stack. If that makes any sense. :) |
| All times are GMT -5. The time now is 1:38 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC