Skip to content

Commit 576558c

Browse files
authored
Improve vignette and fix URL (#10)
* Improve vignette with package examples * Add a news entry.
1 parent d230d1d commit 576558c

File tree

2 files changed

+63
-5
lines changed

2 files changed

+63
-5
lines changed

NEWS.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@
1515
which is the default value. Upon unload, the warning level is restored to
1616
the old value. ([#8](https://github.com/r-assist/errorist/pull/8))
1717

18+
- Fixed a spurious URL in README/NEWS.md
19+
20+
## Documentation
21+
22+
- Improved the package vignette by providing examples of how the handler pick
23+
up errors and warnings. ([#10](https://github.com/r-assist/errorist/pull/10))
24+
25+
1826
# errorist 0.0.3
1927

2028
## Fixes
@@ -54,7 +62,7 @@ the following folks:
5462
[`addTaskCallback()`](https://stat.ethz.ch/R-manual/R-devel/library/base/html/taskCallback.html)
5563
as a way to create a warning handler and for a brief discussion on "call"
5664
objects.
57-
- [Joshua Ulrich](http://www.joshuaulrich.com/) for advise on incorporating
65+
- [Joshua Ulrich](https://github.com/joshuaulrich/) for advise on incorporating
5866
the semi-documented [`last.warning`](https://stat.ethz.ch/R-manual/R-devel/library/base/html/warning.html)
5967
object that _R_ populates with warning messages.
6068

vignettes/working-with-errorist.Rmd

Lines changed: 54 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
2-
title: "Working with the errorist package"
3-
author: "JJB"
2+
title: "Workflow while using the errorist package"
3+
author: "James Joseph Balamuta"
44
date: "`r Sys.Date()`"
55
output: rmarkdown::html_vignette
66
vignette: >
7-
%\VignetteIndexEntry{Working with the errorist package}
7+
%\VignetteIndexEntry{Workflow while using the errorist package}
88
%\VignetteEngine{knitr::rmarkdown}
99
%\VignetteEncoding{UTF-8}
1010
---
@@ -16,6 +16,7 @@ knitr::opts_chunk$set(
1616
)
1717
```
1818

19+
# Overview
1920

2021
The `errorist` package is designed to provide support for newcomers to _R_ who
2122
are learning how to write code. Philosophically, `errorist` takes the position
@@ -25,7 +26,10 @@ These handlers propogate the messages raised by _R_ into the
2526
[`searcher`](https://CRAN.R-project.org/package=searcher) package, which
2627
automatically searches the contents on [Google](https://google.com/) by default.
2728

28-
Thus, to use `errorist` in a causal manner, please type:
29+
30+
## Usage
31+
32+
To use `errorist` in a causal manner, please type:
2933

3034
```{r}
3135
library(errorist)
@@ -38,3 +42,49 @@ the `disable_errorist()` function or detach the package.
3842
detach("package:errorist", unload = TRUE)
3943
```
4044

45+
## Error Search
46+
47+
During development, many issues can arise. With `errorist` enabled, each
48+
error is automatically searched. For instance, if we typed a function that
49+
wasn't defined, we'd get:
50+
51+
```r
52+
f()
53+
```
54+
55+
```{r, echo = FALSE}
56+
message('Error in f() : could not find function "f"')
57+
message('Searching query in a web browser ... ')
58+
```
59+
60+
## Warning Search
61+
62+
Outside of errors, the second most common issue is receiving **warnings**.
63+
Warnings only indicate a recoverable issue has occurred during a function run.
64+
As a result, there can be many warnings that build up during an estimation routine.
65+
If `errorist` is enabled, each unique warning will automatically be searched
66+
within its own tab in the browser. As an example, consider the following function:
67+
68+
```r
69+
many_warnings = function() {
70+
warning("First warning")
71+
warning("Second warning")
72+
warning("Random warning")
73+
warning("Random warning")
74+
}
75+
```
76+
77+
This function when run will issue exactly **four warnings**. However, only
78+
three of these warnings are unique. Thus, there will be exactly **three**
79+
searches performed after the function finishes its execution.
80+
81+
```{r, echo = FALSE}
82+
message("Warning messages:")
83+
message("1: In many_warnings() : First warning")
84+
message("2: In many_warnings() : Second warning")
85+
message("3: In many_warnings() : Third warning")
86+
message("Searching query in a web browser ... ")
87+
message("Searching query in a web browser ... ")
88+
message("Searching query in a web browser ... ")
89+
```
90+

0 commit comments

Comments
 (0)