Posted: Tue Aug 02, 2011 1:43 pm Post subject: How to handle runtime errors?
Hi, perhaps somebody has asked this before, but since the forum search returns the '404 not found', I would like to ask it anyway.
Is there a way to handle runtime errors in a script?
I mean, if some task fails to do something, like trying to open a file
that is not present or something more intrinsic(cause the former could be done by using if(!access("file")) before ) like some error computation when using imalign, is there a way of continuing using a script handling that specific case as say, a conditional? If an error is returned in performing a given task within a script, change some parameters and run that task again.
thanks
Best regards!
Error handling in the CL is done using the 'iferr' expression, e.g.
Code:
iferr {
<block of statements>
} then {
<block of error stmts>
}
So an error in any of the tasks in the first block will cause statements in the second block to be executed, otherwise the second block is ignored. For more details on this, see the explanation in the iraf$pkg/ecl/Notes.ecl file
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum