Questions tagged [message-coding]
Questions about coding the generation of Messages and about the Message subsystem itself.
98
questions
2
votes
1
answer
77
views
Is there a comprehensive list of most common or most important native Message-s (w/tags) for errors and Failed?
Yes I understand how to use Messages[symbol] but that doesn't help much. I have no idea which important ones I may have missed in my search or even how many exist. ...
4
votes
0
answers
116
views
What do “Analyze Notebook" and "Analyze Cells" Do?
What does "Analyze Notebook" and "Analyze Cells" do?
They seem to, at least, point out some coding errors that are already highlighted in a notebook. Do they do anything else?
Is ...
2
votes
1
answer
50
views
Why is Style ignored in my custom Echo error function?
To highlight the type of error that occurred the function echoError (via err) should display type of error in color: ...
1
vote
0
answers
44
views
Is it possible to trigger some Mathematica code when an error of the type StringTake::take happens?
I process data from various sources (databases) that are formatted very inconsistently. I would like to be able to process them finally summarized in one piece.
My code consists of many cases of ...
5
votes
1
answer
144
views
Print a Message
Is there a way to Print a message suitable for Message? I want to recycle some messages (but ...
3
votes
1
answer
53
views
Avoid MachinePrecision numbers in Message
Can I change the output of Message to not show MachinePrecision numbers? E.g.
...
3
votes
2
answers
84
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
1
answer
115
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 ...
6
votes
3
answers
627
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
1
answer
106
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
1
answer
84
views
0
votes
0
answers
45
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
3
votes
1
answer
70
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
1
answer
174
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
0
answers
64
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
0
answers
58
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
0
answers
61
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
1
answer
167
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
2
answers
353
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 ...
2
votes
1
answer
106
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
1
answer
106
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
1
answer
324
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
2
answers
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
2
answers
97
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
0
answers
49
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
1
answer
334
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 ...
9
votes
1
answer
122
views
Understanding EvaluationData in messages context
Can I Quiet my procedure and still get messages info from inner EvaluationData?
This works fine:
...
7
votes
3
answers
508
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
3
answers
235
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
1
answer
133
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
2
answers
96
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
1
answer
254
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
2
answers
289
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
2
answers
335
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
1
answer
130
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
1
answer
209
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
1
answer
185
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 ...
2
votes
0
answers
195
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
1
answer
76
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
1
answer
45
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
1
answer
97
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
1
answer
310
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
0
answers
46
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 ...
26
votes
1
answer
551
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
1
answer
165
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
3
answers
234
views
Is it possible to assign numbers generated in an Error-Message?
If I have a differential equation of the form:
...
1
vote
0
answers
125
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
1
answer
1k
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
1
answer
75
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
1
answer
128
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...