You can suppress informational messages using !quiet, suppress math errors using !except, and error messages using catch. You can set the environment variable !quiet = 1 which will suppress all informational messages from IDL. It is important to remember that this only stops informational messages from appearing, not error messages. It would be best to include a line that returns !quiet = 0 at the end of your program if you do change the value. However f you suppress informational messages, and you still get an error, IDL will halt the execution of your program and spit out the error. To catch errors, an example using catch is shown below as well as a link to controlling and recovering from errors.
http://www.exelisvis.com/...ng_and_Recoveri.html
PRO test_catch
Catch, errorStatus
IF (errorStatus ne 0) then begin
;a=10
MESSAGE, /RESET
GOTO, CONT
ENDIF
;print the value of a before it is defined
;this makes an error which is found by catch
PRINT, a
CONT:
PRINT, 'done'
END