Skip to content
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

Teach evaluate about condition handlers #98

Closed
jennybc opened this issue Aug 11, 2020 · 4 comments
Closed

Teach evaluate about condition handlers #98

jennybc opened this issue Aug 11, 2020 · 4 comments
Labels
feature a feature request or enhancement

Comments

@jennybc
Copy link
Member

jennybc commented Aug 11, 2020

@lionel- and I have talked about this (tidyverse/reprex#320 (comment)) but I want to open a specific issue.

Until this happens, rlang::last_error() and rlang::last_trace() don't work, in general, in knitr and, therefore, in reprex. We can still do options("rlang:::force_unhandled_error" = TRUE) on a case-by-case basis, but @lionel- feels it does more harm than good if I were to make that global or default reprex behaviour.

@lionel-
Copy link
Member

lionel- commented Aug 11, 2020

I experimented with this in:

@hadley
Copy link
Member

hadley commented Jun 14, 2024

Would also be cool if evaluate could automatically cross-register global error handlers.

@hadley hadley added the feature a feature request or enhancement label Jun 14, 2024
@lionel-
Copy link
Member

lionel- commented Jun 17, 2024

This was implemented in #105

Would also be cool if evaluate could automatically cross-register global error handlers.

For expected errors you mean, because our try-catch prevents the global handlers from running? hmm... Interesting idea but automatically copying handlers on top of an existing R stack has the potential for unexpected behaviour. We'd need to check whether this has unintended effects with Ark for instance (I think it does). Alternatively we could require the handler to implement some interface that declares it's okay to copy it in nested "repl" contexts.

@hadley
Copy link
Member

hadley commented Jun 17, 2024

Ok great!

Yeah I also realised copying automatically is likely to be fraught. Might instead be better for evaluate to expose its own system for registering handlers. Anyway I’ll keep thinking about it as I work on evaluate.

@hadley hadley closed this as completed Jun 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement
Projects
None yet
Development

No branches or pull requests

3 participants