Questions tagged [message-coding]

Questions about coding the generation of Messages and about the Message subsystem itself.

Use this tag if the question is about how to specify, suppress, deal with or intercept messages. General questions about Mathematica's way of handling errors should use this tag. Questions about understanding specific error messages or finding the source of errors should use instead. Messages can be turned on/off by the On/Off commands and be temporarily silenced by the Quiet function.

Example questions:

109 questions
25
votes
3 answers

Is there any way to allow a message to appear more than three times before General::stop shuts it off?

I have some Mathematica code that analyzes data in a database and uses Message to report when expected data is missing. By default, Mathematica will allow this message to appear only three times before it gets shut off, but I'd like this message to…
Michael Stern
  • 4,695
  • 1
  • 21
  • 37
13
votes
3 answers

How to limit number of user-defined messages issued per evaluation

I have written code such that if it runs into a particular function, a warning message is issued. However, it is common for the program to call this function several times in a single evaluation, but the warning message need be issued only…
QuantumDot
  • 19,601
  • 7
  • 45
  • 121
12
votes
1 answer

Retrieving the text of a message

Is there a simple, built-in way to retrieve the text of a message, given it's identifier (such as Power::infy)? The documentation describes how Message does this: it looks for different language versions (Power::infy::langname), then it looks under…
Szabolcs
  • 234,956
  • 30
  • 623
  • 1,263
9
votes
3 answers

Detect Messages within an expression without losing the return value?

I know that Check[expr,failexpr] is a mechanism to catch messages. The problem with it is that if a message is generated within expr, Check[expr,failexpr] will return failexpr, and the return value of expr will be lost. Sometimes messages are just…
a06e
  • 11,327
  • 4
  • 48
  • 108
8
votes
1 answer

How to use Message with an error string without predefining it first?

I need a very simple error reporting using Message. But I do not want to pre-define each error message separately as shown What are the best practices / most common / idiomatic ways to report errors in Mathematica? for example, and in many other…
Nasser
  • 143,286
  • 11
  • 154
  • 359
6
votes
4 answers

Passing a variable messages list to Quiet

I'm trying to build a Verbose option into some code but I'm having trouble passing to a Quiet statement a variable list of which messages I want to suppress. My naïve try is code along the lines of f[x_] := Module[{messageList}, messageList =…
Emilio Pisanty
  • 10,255
  • 1
  • 36
  • 69
5
votes
2 answers

How restore printing of messages?

In the upper left hand corner of my message window, the button reads "Delete all messages". I don't get any messages at all. How can I get messages restored.
Freed
  • 51
  • 1
5
votes
1 answer

Print a Message

Is there a way to Print a message suitable for Message? I want to recycle some messages (but Print them, so they don't get suppressed after X times and look like Print output). E.g. Test::message="This is test number…
Chris K
  • 20,207
  • 3
  • 39
  • 74
5
votes
1 answer

How to get all messages defined for a built-in symbol?

AFAICT, when given a built-in symbol as argument, Messages returns an empty list, at least initially. For example: Quit (* reset *) Messages[ListPlot] {} After running ??ListPlot, however, I get Messages[ListPlot] {HoldPattern[ListPlot::usage]…
kjo
  • 11,717
  • 1
  • 30
  • 89
4
votes
1 answer

How to specify that Quiet should silence foo::shdw messages for ANY symbol foo?

I have some package code that does rather complex multi-context evaluation, and I know it's going to throw warnings about shadowed symbols. The shadowing isn't actually a problem. For the end-user's sake, I want to suppress these warnings. Quiet can…
ibeatty
  • 2,533
  • 11
  • 22
4
votes
1 answer

Disable alert message with internet connectivity off

I work in an environment that has mathematica's internet connectivity turned off under Help > Internet Connectivity. Recently, after installing mathematica 10.0, every time mathematica is loaded it complains about internet connectivity and put up…
egwene sedai
  • 2,355
  • 16
  • 24
3
votes
2 answers

How to count the number of occurences of a warning messages in the current session?

After reading: How to count the actual occurence of a warning message in a Do loop? I wonder about a broader question: how to count the number of occurences of a warning messages in the current session ? My first try was counter[arg_] := Module[{},…
mitochondrial
  • 1,843
  • 10
  • 16
3
votes
3 answers

How to express Error Message as 'Output Cell'?

I got a random error message. expr = N[Pi, a] expr = Sin[x, The error message does not appear in the 'Output Cell'. In : msg = "How do I write the code?" However, you must write the code using only 'expr' or 'N[Pi,a]' Out :…
Milk
  • 1,688
  • 10
  • 9
1
vote
0 answers

Redirect Messages

The command nb = CreateDocument[{}] opens an empty notebook. What I want to do is to redirect messages as generated by Mathematica so that they appear in this empty notebook. For example, when I enter 1/0 I want to see the generated message…
Fred Simons
  • 10,181
  • 18
  • 49
0
votes
2 answers

How to preserve the state of messages across a block?

Is there a way to inquire whether a given message is switched On or Off without modifying the $Messages variable? The documentation is completely mum about it, it seems. Conversely, if such inquiry is not recommended by design intent, is it at…
1
2