Comments

jetdv wrote on 10/10/2005, 6:21 AM
Yes, try commands can be nested but they BOTH need their own "Catch" section.
JohnnyRoy wrote on 10/10/2005, 6:58 AM
Gordie,

JetDV already answered the question but since you had to ask, I assume you may not fully understand what a try/catch block is used for. This knowledge may be important in getting your script to work correctly.

Before there were try/catch blocks in programming languages you had to check the return of every call to see if an error occurred. This actually obfuscated the flow of the code sometimes because there was more error checking code than business logic in the program. Try/catch gives you a way of saying "if anything goes wrong in the try block, stop and do the catch block". So it is an error handler.

Depending on what you are doing, you may not need or want the nested try/catch block at all. For example, we wrap all scripts a giant try/catch block so we can issue a friendly error message if anything goes wrong anywhere in the script. If your nested try/catch block is one of these, you may be able to simply remove it entirely because the outer block will take care of that. In fact, you will want to remove it so that the script ends after the error instead of continuing without the information it needs to complete its task.

If, however, the nested try/catch block is around a critical piece of code (like doing file i/o) then you want it there so that execution continues after the catch block. So it is important for you to understand the purpose of the try/catch block in order to know whether to nest it, or remove it.

Sorry for such a long post to answer a simple question but I felt the answer wasn’t simply "Can you next try/catch blocks?" You can, but why you copied the try without the catch (which caused the error) and whether you should add the catch or delete the try is the important question to having your code work correctly.

I hope this will help you in writing your code. Fell free to ask more questions if I’ve confused you at all.

~jr
gordie wrote on 10/14/2005, 10:00 PM
ok, well, for the time being, how can I make the RenderImageSequence script work like the RenderQueue?

That might be an easier thing to try, becuase all I'm getting are errors.