ConfirmQuiet
ConfirmQuiet[expr]
confirms that no messages are generated during the evaluation of expr, otherwise quieting them and throwing an error to the nearest surrounding Enclose.
ConfirmQuiet[expr,s::t]
tests only for the specified message.
ConfirmQuiet[expr,{s1::t1,s2::t2,…}]
tests only for the specified list of messages.
ConfirmQuiet[expr,"group"]
tests only for messages in the named message group.
ConfirmQuiet[expr,mspec,info]
evaluates info and includes its value in the thrown error if expr is not confirmed.
ConfirmQuiet[expr,mspec,info,tag]
uses the specified tag for any thrown errors.
Details
- ConfirmQuiet[expr,…] returns expr if the evaluation of expr does not generate any specified messages.
- ConfirmQuiet is dynamically scoped when given a tag. Otherwise, it is lexically scoped. »
- The default value of info is Null.
- ConfirmQuiet does not test for messages that have been switched off using Off, or by uses of Quiet that occur inside it.
- The operation of ConfirmQuiet is not affected by being enclosed inside Quiet.
- In ConfirmQuiet[expr,"name"], possible named message groups are given by $MessageGroups.
- ConfirmQuiet stops evaluation when the first matching message is generated. »
- ConfirmQuiet[expr] is equivalent to ConfirmQuiet[expr,All].
- Failure objects generated by ConfirmQuiet include the following fields:
-
"Information" info from ConfirmQuiet[expr,mspec,info,…] "HeldExpression" Hold[expr] from ConfirmQuiet[expr,…] "HeldMessage" Hold[s::t] for the detected message s::t - Values of these fields can be extracted using failure["prop"] or directly through Enclose[expr,"prop"].
Examples
open allclose allBasic Examples (1)
ConfirmQuiet[expr] gives expr if evaluating expr does not generate any messages:
Evaluation is stopped as soon as a message is generated, and an error is thrown to the surrounding Enclose:
Scope (3)
ConfirmQuiet stops evaluation and returns to the matching Enclose when a matching message is generated:
info is only evaluated when expr cannot be confirmed:
Create a function that calls ConfirmQuiet with a tag so that it can be caught dynamically:
If no tag is given, ConfirmQuiet is lexically scoped:
Properties & Relations (2)
Unlike Check, ConfirmQuiet stops evaluation once a message is generated:
ConfirmQuiet does not detect messages suppressed by an inner Quiet:
However, ConfirmQuiet does detect messages suppressed by an outer Quiet:
Possible Issues (3)
ConfirmQuiet must be given a tag or be within a lexical Enclose:
Untagged ConfirmQuiet works by replacing instances of the symbol ConfirmQuiet with a tagged variant:
Tagged ConfirmQuiet requires an Enclose with a matching tag:
Text
Wolfram Research (2020), ConfirmQuiet, Wolfram Language function, https://reference.wolfram.com/language/ref/ConfirmQuiet.html.
CMS
Wolfram Language. 2020. "ConfirmQuiet." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/ConfirmQuiet.html.
APA
Wolfram Language. (2020). ConfirmQuiet. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ConfirmQuiet.html