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]

if expr is not confirmed, evaluates info and includes its value in the thrown error.

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.
  • 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 all

Basic Examples  (1)

ConfirmQuiet[expr] gives expr if evaluating expr does not generate any messages:

Evaluation is stopped as soon as 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  (1)

Unlike Check, ConfirmQuiet stops evaluation once a message is generated:

Possible Issues  (4)

ConfirmQuiet detects quieted messages:

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:

Wolfram Research (2020), ConfirmQuiet, Wolfram Language function, https://reference.wolfram.com/language/ref/ConfirmQuiet.html.

Text

Wolfram Research (2020), ConfirmQuiet, Wolfram Language function, https://reference.wolfram.com/language/ref/ConfirmQuiet.html.

BibTeX

@misc{reference.wolfram_2021_confirmquiet, author="Wolfram Research", title="{ConfirmQuiet}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/ConfirmQuiet.html}", note=[Accessed: 28-July-2021 ]}

BibLaTeX

@online{reference.wolfram_2021_confirmquiet, organization={Wolfram Research}, title={ConfirmQuiet}, year={2020}, url={https://reference.wolfram.com/language/ref/ConfirmQuiet.html}, note=[Accessed: 28-July-2021 ]}

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