[Rd] Unexpected Error Handling by Generic in R 4.0.1

Matthew Carlucci M@tthew@C@r|ucc| @end|ng |rom c@mh@c@
Thu Jun 25 20:21:02 CEST 2020


Hello R-devel community,

I posted a new R 4.0.1 behaviour to stack overflow (https://stackoverflow.com/questions/62327810/inconsistent-error-handling-of-function-and-s4-generics-on-r-4-0-1), where I think it is an undesired or unexpected change in 4.0.1. Attributes of errors seem to be lost or obscured when encountered in an S4 generic context.

An example of this being undesirable comes in shiny applications where my_reactive (an unevaluated reactive object) returns a shiny.silent.error attribute which is lost upon error within an S4 generic function. The lack of this attribute causes the entire application to exit with an error (with no stack trace available). For example, within a shiny context:

> foo <- try(nrow(my_reactive()))

> attr(foo,"condition")

<shiny.silent.error: >

Where the S4 generic returns:

> bar <- try(BiocGenerics::nrow(my_reactive()))

> attr(bar,"condition")

<simpleError in (function (cond) .Internal(C_tryCatchHelper(addr, 1L, cond)))(structure(list(message = ""), class = c("shiny.silent.error", "validation", "error", "condition"), stack.trace = [... lots more output here ...]: error in evaluating the argument 'x' in selecting a method for function 'nrow': >

>From what I can tell from the release notes of 4.0.1, this does not appear to be an expected breaking change so I am hesitant to update old code and shiny applications to account for this behaviour. Any guidance would be appreciated.

Thank you,

Matthew Carlucci

CONFIDENTIALITY NOTICE: This e-mail message, including a...{{dropped:18}}



More information about the R-devel mailing list