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

message(simpleError('msg')) should not behave like stop(simpleError('msg')) #71

Closed
flying-sheep opened this issue Aug 31, 2016 · 1 comment

Comments

@flying-sheep
Copy link
Contributor

flying-sheep commented Aug 31, 2016

as explained in IRkernel/IRkernel#231 (comment), the following code shouldn’t trigger the stopifnot.

msg <- NULL
err <- NULL
oh <- evaluate::new_output_handler(
    message = function(m) msg <<- m,
    error   = function(e) err <<- e)

evaluate(
    "tryCatch(stop('I should be caught as message'), error = message)",
    output_handler = oh)

stopifnot(is.null(err))
@hadley
Copy link
Member

hadley commented Jun 14, 2024

Maybe R has changed in the last ~8 years, but the current behaviour looks consistent with the console to me:

rlang::catch_cnd(tryCatch(stop('I should be caught as message'), error = message))
#> <simpleError in doTryCatch(return(expr), name, parentenv, handler): I should be caught as message>

@hadley hadley closed this as completed Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants