Submit a Story  :  IRAF Links  :  Past Polls  :  Calendar  :  Advanced Search  
     iraf.net
FAQ
 Forum FAQForum FAQ   Forum SearchForum Search   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to handle runtime errors?

 
Post new topic   Reply to topic    iraf.net Forum Index -> General IRAF
View previous topic :: View next topic  
Author Message
sebastian
Active IRAF User


Joined: 21 Mar 2007
Posts: 45

PostPosted: Tue Aug 02, 2011 1:43 pm    Post subject: How to handle runtime errors? Reply with quote

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!

seba
Back to top
View user's profile Send private message
fitz
Site Admin


Joined: 30 Sep 2005
Posts: 3257
Location: Tucson

PostPosted: Fri Aug 05, 2011 1:33 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    iraf.net Forum Index -> General IRAF All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2009 phpBB Group
 Copyright © 2005-2011 iraf.net
 All trademarks and copyrights on this page are owned by their respective owners.
Powered By Geeklog 
Created this page in 0.36 seconds