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

Bug: set_autos() needs to safely source functions to account for errors #65

Open
nicholas-masel opened this issue Jul 5, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@nicholas-masel
Copy link
Collaborator

What happened?

An error in a function that is automatically sourced in a .Rprofile, causes the session to fail to start. So you get no R session at all and no log when launching that project from RStudio WB.

Session Information

No response

Reproducible Example

No response

@nicholas-masel nicholas-masel added the bug Something isn't working label Jul 5, 2024
@nicholas-masel
Copy link
Collaborator Author

After more thought. I see a few options:

  1. We can capture the errors and return as a part of the package.
  2. We can advise using purrr::safely() in your .Rprofile to create a safe version of rprofile() to make this call when using autos and then print the error.

This could be an option we allow users/companies to toggle on/off.

@nicholas-masel
Copy link
Collaborator Author

nicholas-masel commented Jul 5, 2024

For option 2, an example .Rprofile could be:

library(envsetup)

safe_rprofile <- purrr::safely(rprofile)

ret <- safe_rprofile(config::get(file = "path/to/envsetup.yml"))

if(!is.null(ret$error)) {
  print(ret$error)
}

@nicholas-masel
Copy link
Collaborator Author

@mstackhouse Let me know what you think and I'll move ahead implementing either in a vignette to explain using safely() or with a safely() version of rprofile().

@mstackhouse
Copy link
Contributor

mstackhouse commented Oct 9, 2024

@nicholas-masel Are you leaning one way or the other? I can really see merits to both. The first way, we're handling it for them but being verbose enough to be useful. The second way, the setup is explicit and through the guidance we're showing them how exactly to do it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants