Closed gaborcsardi closed 2 years ago
With the current feature/errors-v3
branch this is:
❯ R -q -e 'callr::r(function() library(sdfsdfsd))'
> callr::r(function() library(sdfsdfsd))
Error: :
! error in callr subprocess
Caused by error in `library(sdfsdfsd)`:
! there is no package called ‘sdfsdfsd’
---
Backtrace:
1. callr::r(function() library(sdfsdfsd))
2. callr:::get_result(output = out, options) at eval.R:189:3
3. callr:::throw(callr_remote_error(remerr)) at result.R:67:5
4. callr:::callr_remote_error(remerr) at result.R:67:5
5. callr:::throw(err, parent = remerr[[3]]) at error.R:44:3
---
Subprocess trace:
1. base::library(sdfsdfsd)
2. base::stop(packageNotFoundError(package, lib.loc, sys.call()))
3. global (function (e)
Execution halted
and with cli it is even nicer:
❯ R -q -e 'library(cli); callr::r(function() library(sdfsdfsd))'
This has been fixed by #335.
In particular, if the stack is printed, then we don't need to print the errors up front:
It gets quite annoying when stdout/stderr is embedded into the error message.