Re: Catching messages
- To: mathgroup at smc.vnet.net
- Subject: [mg91566] Re: Catching messages
- From: David Bailey <dave at Remove_Thisdbailey.co.uk>
- Date: Thu, 28 Aug 2008 03:14:19 -0400 (EDT)
- References: <g90bg1$n91$1@smc.vnet.net>
thorgal wrote: > Is there an easy way to immediately abort a function that was called > when it generates a given message and return to the part of the > program that called this function ? I want to do this when I call > some function from Mathematica packages, i.e. i don't want to change > to function code in the packages and include e.g. catch-throw > sequences. > I don't think your request is very meaningful as stated. When you call a function - even some built-in ones - that function may make several sub-calls before the diagnostic is generated. Falling back one level (which is more or less what happens anyway after the diagnostic has been generated) is not really useful, and tends to result in a cascade of errors. Why not tell us a bit more about what you are trying to achieve. For example, if you are trying to do something like a minimisation (where the package contains the minimation code), and the function can misbehave for some values, wrap the function in another which catches the errors and returns a suitable numeric value in these cases. David Bailey http://www.dbaileyconsultancy.co.uk