Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

nesting trys and catches  RSS feed

 
Joe Panully
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to nest some try statements and im erroring with it saying that it's not picking up the catches. I know this is probably a simple bug but could someone please help me, thx.

[ November 18, 2004: Message edited by: Joe Panully ]
 
Henry Wong
author
Sheriff
Posts: 22840
119
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The catch must follow the try it is catching from....



Henry
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24215
37
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Joe,

What you've done is exceedingly creative, but unforunately, it's wrong.
Instead of separating all the trys into one pile, and the catches into another pile, each "catch" has to immediately follow its "try", like



Here you see one "top-level" try/catch, with one more try/catch nested inside its try block, and another nested inside its catch block.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!