Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simpleMessage cannot be muffled (error: No restart muffleMessage found) #75

Open
aryoda opened this issue Sep 4, 2022 · 1 comment
Open
Labels

Comments

@aryoda
Copy link
Owner

aryoda commented Sep 4, 2022

In the current version 1.3.2 (and possibly older ones) some message conditions cannot be muffled but throw an error, eg.:

tryCatchLog(signalCondition(simpleMessage("You cannot muffle simple messages, only standard messages")), silent.messages = T)
# Error in invokeRestart("muffleMessage") : 
# no 'restart' 'muffleMessage' found

Compare: Standard messages can be muffled:

tryCatchLog(message("You cannot muffle simple messages, only standard messages"), silent.messages = T)
@aryoda aryoda added the bug label Sep 4, 2022
@aryoda
Copy link
Owner Author

aryoda commented Sep 4, 2022

First diagnoses:

invokeRestart should only be called if a restart with the name does really exist, eg. here:

invokeRestart("muffleMessage") # the message will not bubble up ("propagate") now but will only be logged

Use findRestart to check this before calling the restart (everywhere in tryCatchLog).

I think "muffle warnings" is also affected (restart not always found, eg. for simpleWarning).

See also: rlang::cnd_muffle

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant