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

Examine error handling features of rlang package #49

Open
aryoda opened this issue Oct 3, 2019 · 0 comments
Open

Examine error handling features of rlang package #49

aryoda opened this issue Oct 3, 2019 · 0 comments

Comments

@aryoda
Copy link
Owner

aryoda commented Oct 3, 2019

See the excellent eRum 2018 presentation:

Reducing bewilderment by improving errors | Lionel Henry

Among the many unusual features of the R language, the condition system is probably one of the most obscure. While it is mainly used for exception handling, it is much more powerful and general. This presentation will get advanced R programmers up to speed on the difference between messages and printed output, the difference between exiting and inplace handlers, how does condition muffling work (e.g. suppressWarnings() and suppressMessages()), how to implement error recovery, and how to use error objects to make unit testing more robust and to pass useful metadata to error handlers.

Slides:
https://www.dropbox.com/s/fi5fswytwatw1kk/condition-erum.pdf

Video:
https://www.youtube.com/watch?v=-v1tp41kizk&t=0s&list=PLUBl0DoLa5SAo_XRnkQA5GtEORg9K7kMh&index=12

See esp. the functions

  • abort
  • warn
  • inform
    to enrich conditions with a subclass and data which allows more precise condition reporting (see slides 24 + 25)... or a parent condition (chained errors, see slide 37)...

Chained errors... parent errors... to catch low-level technical errors and rethrow them with a message that makes sense to end users... (slides 36 + 37)

Subclassing for fine-grained error handling: Slide 26

Nice backtrails formatting (with visual code indention in case of multiple code lines)...

See also:

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