Re: Check[] *and* Off[]
- To: mathgroup at smc.vnet.net
- Subject: [mg21894] Re: Check[] *and* Off[]
- From: Paul Howland <paul.howland at nc3a.nato.int>
- Date: Wed, 2 Feb 2000 22:54:52 -0500 (EST)
- Organization: NATO C3 Agency
- Sender: owner-wri-mathgroup at wolfram.com
Well... before anyone wastes their breath trying to answer my question about whether it is possibly to "silently" trap an error message using Check[], I have found the way to do it. And it is trivial. All you need do is temporarily redefine the messages channel. So, the answer is, do this: messagechan=$Messages; $Messages={}; Check[myfunction[], myerrfunction[]]; $Messages=messagechan; and the screen no longer fills up with unwanted error messages. The only slight disadvantage of this approach is that *all* error messages are lost, so if you are trying to Check[] for specific messages only, then you won't see the messages you're not trapping. I guess in this situation you might want to re-direct $Messages to a file instead. Paul