The routine for catching errors in IDL is called CATCH. I don't know much about DFPMIN, but, if its reaching the limit of the number of interations triggers an IDL error, you can implement syntax like the following, quite possibly most rationally right before the DFPMIN call:
errno = 0
catch, errno
if errno ne 0 then begin
catch, /CANCEL ; Stop IDL from catching more errors
help, !error_state, /STRUCT
help, /TRACEBACK ; Useful in many cases, but not so much in this example
endif
DFPMIN, myX, myGtol, myFmin, myFunc, myDfunc
catch, /CANCEL ; This is useful only if you want to stop error-seeking right after DFPMIN
I just put HELP calls in the "catch block", but you could replace or enhance those with some calls to reset the state of some of your variables, so that DFPMIN can retry or so that it can be skipped over. Catch blocks return to the problem call right after they exit. This is a place where IDL GOTO statements (usually considered bad programming practise) may come in handy.
James Jones
|