'How to catch IDL "message" with /informational flag

I have a astronomy procedure that returns an error message, but it uses the /inf flag. With this flag, none of the normal error flags are set. So how would one catch such an error? For example, I call the procedure, it prints out the informational error message, but how can I check if it outputted such a message? I see it in the console, but how can the program check for this?



Solution 1:[1]

I don't believe that is possible. According to the docs, when the INFORMATIONAL keyword is set, !error_state is not changed.

Set this keyword to issue informational text instead of an error. In this case, !ERROR_STATE is not set. The !QUIET system variable controls the printing of informational messages.

Solution 2:[2]

I think you can do the following (so long as nothing happened in between):

MESSAGE,/REISSUE_LAST

assuming you have IDL version greater than 6.0. If not, then you can just go into the routine, modify it by defining a keyword that returns the message if it was printed to the screen, otherwise it returns nothing.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 mgalloy
Solution 2 honeste_vivere