Questions tagged [message-coding]
Questions about coding the generation of Messages and about the Message subsystem itself.
94
questions
5
votes
1answer
121 views
Print a Message
Is there a way to Print a message suitable for Message? I want to recycle some messages (but ...
3
votes
1answer
47 views
Avoid MachinePrecision numbers in Message
Can I change the output of Message to not show MachinePrecision numbers? E.g.
...
2
votes
2answers
72 views
Information/Information`InformationValueForm using Full- or InputForm
I have a problem with the build-in Information function for user-defined symbols with custom StandardForm in Mathematica 12.1.1.0:
For example with the function ...
6
votes
1answer
84 views
how to obtain all Messages for Mathematica build-in functions?
Help says Messages[symbol] gives all the messages assigned to a particular symbol. These are called message identifiers per help:
Message names always consist of ...
5
votes
3answers
144 views
How to implement try/catch/end try in Mathematica in the most simple way?
There are lots of question/answers about exception handling in Mathematica. I still find exception handling in Mathematica too complicated to work with.
I find Maple much simpler and easier to ...
6
votes
1answer
75 views
Clearing ::usage message
After having assigned the usage message to f using
ClearAll@f;
f::usage=ToString@RandomInteger@{10^10,10^11};
the ...
1
vote
1answer
73 views
0
votes
0answers
39 views
Is it possible to turn off all messages for a specific mathematica file?
I have a general question.
I have a big Mathematica file, which sometimes comes with some messages.
Is it possible to turn off all messages forever in this notebook/file?
BR
Mads
1
vote
1answer
49 views
Restore output to notebook
While playing around in settings, I believe I did something to cause all output to be printed to a pop up window. How do I restore the output to the notebook where the evaluation occurs? In options ...
1
vote
1answer
127 views
Q: How to manage notebook crashes, “In a previous session”, and memory consumption?
I worked in a notebook. Something went wrong. I do not know what or why. The notebook did not react anymore and closed.
After it, I try to open the same notebook. Then the next text appears:
"The ...
2
votes
0answers
50 views
Find errors in collapsed notebook
I usually keep my notebooks collapsed to make understanding what's going on easier. The problem is that if there's an execution error, I have to expand everything in order to even know that there was ...
0
votes
0answers
50 views
Quiet Messages with arguments
I have some global options that determine which messages are shown and which are not, e.g.
$MessagesShown = {Power::infy};
$MessagesNotShown = All;
Now the first ...
0
votes
0answers
52 views
customisable error checking, message handling code
I have an iterated computation running in a while loop, which is bound to fail at some point, at which point I want it to stop, e.g.
...
3
votes
1answer
161 views
Building a function that uses $Assumptions and works like Simplify, FunctionExpand, etc
I want to write a function MySimplify (like built-in Simplify) that takes a second argument to specify additional ...
2
votes
2answers
230 views
How to produce an error message for function with a wrong parameter and default values for other parameter
Consider this function
w[x_Integer: 2, y__List : {1, 2}, z_String: "X"] := {x y, z}
w[4]
{{4, 8}, "X"}
Now I want to define an error message to be displayed ...
1
vote
1answer
85 views
How to catch error messages from parallel kernels
Doing something that throws out an error (warning):
ParallelTable[NIntegrate[1/Sin[10 t], {t, 0, W}], {W, 0, 10, 1}]
In parallel somehow limits a possiblity to ...
1
vote
1answer
101 views
How do I implement this feature in Manipulate?
I am trying to create a dialog box that informs the user when the input is wrong (or even when any type of error occurs) in the manipulate function.
I have the following code:
...
6
votes
1answer
269 views
Print messages of parallel kernels to console
This question shows how to print output to the console, but how about messages?
For the main kernel, I know this way:
...
2
votes
2answers
2k views
How to stop the suppression of the warnings output? [duplicate]
I have some table of numerical integrals, and during the evaluation there are outputs like
NIntegrate::ncvb: NIntegrate failed to converge to prescribed accuracy
after 9 recursive bisections in x ...
3
votes
2answers
95 views
Correct 2D representation in a message string
Message knows how to convert an expression (taken as an argument) into a string before it is spliced into an actual message:
If I run the following in my terminal ...
4
votes
0answers
48 views
Strange behavior of symbol::messageName in debugger [duplicate]
According to the documentation, there are two ways to define a message, which I implement as:
...
4
votes
1answer
326 views
Turn off a message forever?
I am using Mathematica on an offline PC. I constantly get the message PacletInstall::Offline at startup. Is there a way to turn off this message forever?
I know ...
8
votes
1answer
103 views
Understanding EvaluationData in messages context
Can I Quiet my procedure and still get messages info from inner EvaluationData?
This works fine:
...
7
votes
3answers
433 views
Avoiding the suppression of messages by NIntegrate
Consider the following code:
test[x_] := If[1 < x < 2, Message[Test::message]; x^2, x];
NIntegrate[test[x], {x, 0, 3}]
5.33333333333334
I.e. it gives me ...
4
votes
3answers
227 views
Find prefix of list in Association
I am trying to write some kind of demonstration for coding algorithm (for prefix codes).
I have an Association that contains lists of bits (0s and 1s):
...
5
votes
1answer
120 views
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:
...
5
votes
2answers
92 views
Plot & StreamPlot eat my Messages
I have a complicated function for StreamPlot to call that includes some error checking and the use of Message. Somehow the ...
8
votes
1answer
242 views
How to include a backquote in a message?
NB: I know one suboptimal solution to this problem, which I give at the end. I'm looking for a better one. Also, I was not able to solve this problem with the solutions give in Backquote in string ...
3
votes
2answers
277 views
How to get the error information after run a wrong expression
If we run this code:
FindCycle[1, 2, 3, 4, 5]
It will give a error information like:
How to get the error info promption of ...
6
votes
2answers
325 views
Write Unit Test with expected Message
Using Workbench, I would like to check if my function does emit a message under certain circumstances. How can I test this using an .mt file? I only know about the ...
3
votes
1answer
114 views
Numerous Extraneous Error Messages from EvaluationData
In the course of solving question 134644, I encountered the message
Reduce::ztest1: Unable to decide whether numeric quantity -Log[5381171456512]+Log[(-Sqrt[101] Log2-10 Sqrt[101] Log[5]+101 (...
4
votes
1answer
192 views
How to make NIntegrate automatically resort to arbitrary precision if machine precision fails?
Sometimes NIntegrate gives me messages like NIntegrate::slwcon or NIntegrate::ncvb when I ...
13
votes
1answer
176 views
Is there any difference between Quiet and Internal`DeactivateMessages?
Both Quiet and Internal`DeactivateMessages seem to suppress error messages. Does anyone have any experience with them and found ...
1
vote
0answers
174 views
Check, Quiet and VerificationTest with messages?
I have a VerificationTest that is expected to generate some messages. It runs inside of code that uses Check to ...
3
votes
1answer
70 views
Improving `$AssertFunction` to always tell what the assertion test resulted in
I really like this form of assertion failure:
On[Assert];
Assert[1 + 1 == True];
Assert::asrttf: Assertion test 1+1==True evaluated to 2==True that is neither ...
3
votes
1answer
39 views
Disable “The option to save automatically after each result is enabled” warning
Does anybody know a way to disable the message
The option to save automatically after each result is enabled (NotebookAutoSave->True), but the notebook where you are placing results has not been ...
10
votes
1answer
95 views
How to reset the size of the Stack Trace Window?
Normally the size of the Stack Trace window can easily be changed using the ResizeArea element in the lower right corner. However, if one makes this window too ...
25
votes
1answer
303 views
How to get old message formatting in version 11?
Version 11 uses a new-style message formatting.
The new style has useful features, and it is usually desirable. However, when saved in a notebook, it doesn't display correctly in older versions of ...
1
vote
0answers
45 views
Possible bug with Testing Notebook & messages x::y where x has an OwnValue
I think this should be considered a bug (or at least an inconvenience) and should be reported:
Say you have some code generating the $RecursionLimit::reclim2 ...
23
votes
1answer
469 views
How to use Handler functions
It seems that Internal`AddHandler or other functions related to it can be quite helpful sometimes, especially when dealing with messages and such.
But the ...
3
votes
1answer
155 views
Programmatically assign output Hold[…] produced by errors to a variable
expr = Return[1, 2]
Return::nofunc: Function 2 not found enclosing Return[1,2]. >>
(*Hold[Return[1, 2]]*)
However, ...
3
votes
3answers
229 views
Is it possible to assign numbers generated in an Error-Message?
If I have a differential equation of the form:
...
1
vote
0answers
104 views
How can I automatically set an NIntegrate call to zero if NIntegrate::slwcon is observed?
This is a generic question about the NIntegrate function. I am attempting to numerically integrate a function which may or may not be highly oscillatory, based on it's inputs. For a certain sets of ...
7
votes
1answer
877 views
How to stop Mathematica from turning off warning messages in a loop?
I'm using NonLinearModelFit on a large set of data and which contains a nested Do-loop. I'd like to see all of the cases where there is an issue with the non-linear ...
1
vote
1answer
70 views
Please explain this pattern/Message related issue and help with finding workaround
I attempted to clean up my code and also add messages to functions if they are called with wrong arguments. This introduced some error which I tracked down to the following:
...
2
votes
1answer
114 views
Writing my own error and warning messages
Question:
How is message handling implemented in Mathematica when applying Set to unprotected global variables such as $TimeZone...
3
votes
2answers
108 views
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 ...
1
vote
1answer
2k views
How to print a warning/error message from my own module? [duplicate]
I would like to print a warning/error message from my own module. Of course I could use Print["WARNING: my warning"] but in all the output this would be barely ...
4
votes
1answer
261 views
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 ...
2
votes
1answer
406 views
How can I put back the Messages window back to the main Notebook? [duplicate]
After I have clicked something, the errors started popping up in the separate Messages window. I want them to show up in the main window, with the output. How can I do it?