Skip to content

Condition handlers not properly respected by Rcpp::Function evaluation #312

@kevinushey

Description

@kevinushey

Example code that exercises different bits of weirdness / brokenness:

#include <Rcpp.h>
using namespace Rcpp;

// [[Rcpp::export]]
void ouch() { stop("ouch"); }

// [[Rcpp::export]]
void exec(Function f) { f(); }

/*** R
## Fails (no error thrown)
exec(stop)

## Correct (error is thrown)
exec(function() stop("ouch"))

## Correct (error is silenced)
try(silent = TRUE, exec(function() stop("ouch")))

## Correct (error is silenced)
exec(function() try(silent = TRUE, stop("ouch")))

## Fails (error is not silenced)
exec(function() try(silent = TRUE, exec(ouch)))

## Fails (error is not silenced)
exec(function() try(silent = TRUE, exec(function() stop("ouch"))))
*/

cc: @jcheng5, rstudio/shiny#879

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions