Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [message-coding]

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

1
vote
0answers
23 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
24 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
36 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
114 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
51 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
35 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
91 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: ...
4
votes
1answer
115 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
396 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
85 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
44 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
296 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 ...
6
votes
1answer
77 views

Understanding EvaluationData in messages context

Can I Quiet my procedure and still get messages info from inner EvaluationData? This works fine: ...
6
votes
3answers
246 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
183 views

Find prefix of list in Association

I am new with Mathematica, so I am sorry if my question is a little bit trivial. I am trying to write some kind of demonstration for coding algorithm (for prefix codes). I have an Association that ...
4
votes
1answer
83 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
88 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
216 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
255 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
279 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 ...
1
vote
1answer
83 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
147 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
164 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
119 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
54 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
31 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
79 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 ...
22
votes
1answer
278 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
37 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 ...
20
votes
1answer
328 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
116 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
221 views

Is it possible to assign numbers generated in an Error-Message?

If I have a differential equation of the form: ...
1
vote
0answers
57 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 ...
5
votes
1answer
505 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
51 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
98 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
100 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
1k 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
185 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 ...
1
vote
1answer
144 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?
8
votes
1answer
507 views

Checking the argument of user-defined function with side-effect method

Today, I answered a question of mine that asked two month ago. Please see here Now I would like to add the argument checking in this function. Then I used a method that Mr.Wizard answered ...
6
votes
1answer
804 views

How can I see more of the Java stack trace when an exception occurs in JLink?

If I call into Java code via JLink`, and there is an uncaught exception, Mathematica produces a Java::excptn message, and prints ...
5
votes
1answer
421 views

How to check the option value?

Given that I have a function func as follow: To check the value of options, I using the step-by-step method If[] ...
2
votes
1answer
85 views

Messages muted in standalone CDF files

In Mathematica, when you call a function, messages may be generated and shown in a pink Messages window: These messages are shown also for CDF files when you open them with Mathematica. I have ...
12
votes
4answers
774 views

How to check the style and number of arguments like the built-in functions?

Given that I have a function sqrt[x] that I must check the style and number of argument x. I can do like this: ...
13
votes
2answers
305 views

How to properly generate messages from LibraryLink function?

I'm currently using WolframLibraryData::Message to generate messages from a library function, like this: ...
3
votes
1answer
212 views

Handling error in WSTP program C/C++

I have a program, written in C++, which uses WSTP to communicate with Mathematica 10 (i.e., linked using Install["name_program"]). How should my code report an ...
17
votes
2answers
424 views

Messages leak out from Block

Bug introduced in 8.0 or earlier and fixed in 10.1 When assigning message to a symbol localized by Block, I would expect that this message is not accessible ...
6
votes
2answers
131 views

Is it possible to generate a message when precision upgrade occur?

I use Mathematica mostly for numerical simulation, so most of the time double precision (or machine precision) is enough for me. Mathematica has this nice feature of automatically upgrade to arbitrary ...
5
votes
2answers
135 views

Escaping out of (or exiting) a Compiled Function

How do I manually escape out of a compiled function without forcing an error and compromising its speed? Here is an example: ...