extendr / rextendr

An R package that helps scaffolding extendr-enabled packages or compiling Rust code dynamically
https://extendr.github.io/rextendr/
Other
184 stars 27 forks source link

`knitr` does not display error message thrown by `rust_source` #205

Closed Ilia-Kosenkov closed 2 years ago

Ilia-Kosenkov commented 2 years ago

If {extendr} or {extendrsrc} code block fails to compile, we do not get a proper error message in the {knitr} output. This prevents from debugging compilation because all error information is lost, only the fact the compilation was unsuccessful is retained. Desired behavior would be to actually write all that went wrong with Rust compilation to the {knitr} output log.

This is likely related to #150, #155 and might be resolved by #177.

Ilia-Kosenkov commented 2 years ago

Seems something is off in {rlang} and how it renders errors. Potentially it might be related to the size of call stack (with knitr it grows fast). The error originates in rlang:::trace_as_tree()

Error in `$<-.data.frame`(`*tmp*`, "call_text", value = c("knitr::knit(\"test.Rmd\")",  :
  replacement has 12 rows, data has 11
Ilia-Kosenkov commented 2 years ago

Turned out it was an internal {rlang} error https://github.com/r-lib/rlang/issues/1456, fixed in the latest release v1.0.5.