-
-
Notifications
You must be signed in to change notification settings - Fork 878
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
feat: provide a stack trace for fatal errors in chunk #2369
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: eternal-flame-AD <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be honest, I don't fully understand the condition handling stuff in R, but I wonder if this will be a better place to make the change:
Lines 312 to 315 in 0f59bba
withCallingHandlers( | |
if (tangle) process_tangle(group) else process_group(group), | |
error = function(e) if (xfun::pkg_available('rlang', '1.0.0')) rlang::entrace(e) | |
), |
Thank you!
I will think about this more later today, but my initial thoughts for this part is: Rlang documentation says
It seems to be a UX improvement tool to make stop() emit a trace rather than a wrapper that magically adds stack trace. I tried a toy example: myerr <- \() { entrace(cnd = errorCondition("Test")) } # no stack trace when called
trace <- \() myerr() # stack trace only contains trace(), not myerr() xfun::handle_error seems to be undocumented API and, is this meant to catch errors that are even supposed to crash R so it is written as an exit handler instead of just a catch? |
|
My original thought about writing it there was I think an R backtrace is only useful for R engine. Seems only R engine output is improved (presumably because the call to evaluate() here erased the call stack before your chunk-level handler took it. We probably don't really have a case of where we intentionally want to suppress traces for one type of engine. It is fine and probably clearer to lift it up. Found another issue when testing this that I can reproduce on master ... I will look at it this weekend to see what condition triggered this and if it is my environment is bad or another bug ```{python}
print("Hello Python!")
```
```
Error in loadable(pkg) : node stack overflow
Error during wrapup: node stack overflow
Error: no more error handlers available (recursive errors?); invoking 'abort' restart
Quitting from lines 90-91 [hello] (error.Rmd)
```
``` |
034f88d
to
c71021f
Compare
Signed-off-by: eternal-flame-AD <[email protected]>
c71021f
to
361aca5
Compare
Just a bump in case this got lost :) |
No it does not get lost. I have a current workload on Quarto work because we're are working on v1.6 release shortly. So my focus is not right now in R work and I prefer to be focused on topic when I worked on them - sorry to keep you waiting. I'll come back to this very quickly ! Thank you for your patience |
This is the idea which will provide a backtrace of the error instead of just the message: r-lib/evaluate#226 (comment).
Before:
After: