Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

To: Omega Consulting, Problem with $AbortMessage trap (The Mathematica Journal).

  • To: mathgroup at smc.vnet.net
  • Subject: [mg70976] To: Omega Consulting, Problem with $AbortMessage trap (The Mathematica Journal).
  • From: "Philipp" <Philipp.M.O at gmail.com>
  • Date: Fri, 3 Nov 2006 01:39:26 -0500 (EST)

I've been working on an extension to your solution of immediate
interception of Message[] to make it sensitive only to specified
messages (analogous to the Check[]).

But this aside, I have encountered a curious behaviour of your original
solution, namely

In[]:=   Unprotect[Message];
         Message[args___] :=
          (Block[{$AbortMessageQ = False}, Message[args]]; Abort[]) /;
             $AbortMessageQ
         Protect[Message];


In[]:=   $AbortMessageQ = False;


In[]:=   (Log[1, 1]; Prime[-120]; StringLength[ToString[N[Pi, 10^5]]])

         General::"dbyz": "Division by zero."

         \[Infinity]::"indet": "Indeterminate expression
           0 ComplexInfinity encountered."

         Prime::"intpp": "Positive integer argument expected
           in Prime[-120]."

Out[]:= 100001

Now setting he control variable to True

In[]:=   $AbortMessageQ = True;

gives the expected result, i.e.,

         General::"dbyz": "Division by zero."

Out[]:=  $Aborted

However, using Off[] to turn off the first message,

In[]:=   Off[General::"dbyz"]

In[]:=   (Log[1, 1]; Prime[-120]; StringLength[ToString[N[Pi, 10^5]]])
Out[]:=  $Aborted

fails to print the message.

Could you please explain such a curious behaviour, and maybe provide a
remedy?

Cheers,
Philipp


  • Prev by Date: Re: Context
  • Next by Date: RE: Algebraic re-substitution
  • Previous by thread: Re: Graphics--ContourPlot output varies drastically with PlotPoints.
  • Next by thread: Re: To: Omega Consulting, Problem with $AbortMessage trap (The Mathematica Journal).