idl programming language - How to correctly implement error handling? -


After

I can not call a function fit_circle or message / Code> Process fit_circle (there is nothing that can do about this) can call a function poly_fit message Process, but it also occasionally generates a math error call.

Is it possible to transmit an error handler, which will take care of all these situations without returning to the interactive prompt?

  function arb_funct, circular_data capture, error error NE 0 then start catching, / print, 'error occurred' return, [] endif circle_fit_result = fit_circle cancellation (circular_data: Returns, circle_fit_result END  

Although the error handler never triggers, only the mention is in search of error handlers defined in the processes.

This is my example code:

  support Mg_error_demo_helper2 compile_opt strictarr a = b end supporter mg_error_demo_helper1 compile_opt strictarr mg_error_demo_helper2 end-proprietor mg_error_demo compile_opt hold strictr, error if (error ne 0l) then hold start / print cancellation, returned endif mg_error_demo_helper1 end 'an error occurred'  

When I run it, I get:

  IDL> Mg_error_demo% compiled module: MG_ERROR_DEMO error occurred  

Comments