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

Provide condition handling vignette with best practices #33

Open
aryoda opened this issue Jul 29, 2018 · 1 comment
Open

Provide condition handling vignette with best practices #33

aryoda opened this issue Jul 29, 2018 · 1 comment

Comments

@aryoda
Copy link
Owner

aryoda commented Jul 29, 2018

E. g.

  • how to signal a condition (signalCondition?)
  • how to clean-up resources (finally or on.exit)
  • restart types provided by R (invokeRestart("abort") to "rethrow a caught interrupt condition" to interrupt/exit the running R script)

Focus on the typical use cases and show how to apply tryCatchLog for them...

@aryoda
Copy link
Owner Author

aryoda commented Oct 22, 2018

Henry Lionel's talk "Reducing bewilderment by improving errors" at ERUM 2018 gave some good best practices:

  • Error message guidelines: http://style.tidyverse.org/error-messages.html
  • Catch and rethrow low-level technical errors with a message that makes sense to the end user (+ sub class it for precise recognition and recovery/fine-grained handling with tryCatch(exp, this_error = my_handler) and suppress_warnings("that_warning"))
  • add additional (meta) data to the condition, e. g. actual values

See rlang::abort and rlang::warn (signature: msg, subclass, mydata, ...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant