inVINCEable Posted October 13, 2007 Share Posted October 13, 2007 Hello everyone, I have a bit of a general question. I am having trouble wrapping my head around the general concept of catching errors. I have read the tutorials about exceptions on DevShed, as well as on Zend's website. It is still not clear to me. If I throw 5 exceptions, how come I need 5 catch phrases, and what does it mean when it travels up the stack? Sorry I am just really confused with the catch phrases and how they work, although I am almost positive I completely understand the throwing of exception concept. Thank you for any time you take in advising. Quote Link to comment https://forums.phpfreaks.com/topic/73037-trouble-understanding-exception-concept-of-catching-errors/ Share on other sites More sharing options...
trq Posted October 13, 2007 Share Posted October 13, 2007 If you throw 5 different kinds of execeptions then you need 5 catches in place ready to catch each different exception. if your exceptions are not caught by a defined catch then you will get the 'uncaught exception' error. The stack literally refers to the way with which exceptions are caught. Each exception will treverse the stack of catches untill it is eather caught or comes to the end. Quote Link to comment https://forums.phpfreaks.com/topic/73037-trouble-understanding-exception-concept-of-catching-errors/#findComment-368383 Share on other sites More sharing options...
inVINCEable Posted October 13, 2007 Author Share Posted October 13, 2007 Thanks, but I swear I have seen examples where multiple exceptions are thrown, but there exists only one catch block? Is this not possible? Thank you. Quote Link to comment https://forums.phpfreaks.com/topic/73037-trouble-understanding-exception-concept-of-catching-errors/#findComment-368597 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.