Title: | Automatically Search Errors or Warnings |
---|---|
Description: | Provides environment hooks that obtain errors and warnings which occur during the execution of code to automatically search for solutions. |
Authors: | James Balamuta [aut, cre, cph] |
Maintainer: | James Balamuta <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.1.2 |
Built: | 2024-11-02 03:57:35 UTC |
Source: | https://github.com/coatless-rpkg/errorist |
Activates or disengages the automatic look up of error or warning codes in R.
enable_errorist( error_search_func = getOption("errorist.warning", searcher::search_google), warning_search_func = getOption("errorist.warning", searcher::search_google) ) disable_errorist()
enable_errorist( error_search_func = getOption("errorist.warning", searcher::search_google), warning_search_func = getOption("errorist.warning", searcher::search_google) ) disable_errorist()
error_search_func , warning_search_func
|
The search function from |
The enable_errorist()
is automatically called on package start to
inject handlers for warnings and errors. When the package is unloaded,
disable_errorist()
is called to remove warnings and errors. If you
wish to disable warnings or error individually, please use either
disable_error_shim()
or disable_warning_shim()
.
James Joseph Balamuta
enable_error_shim()
, enable_warning_shim()
,
disable_error_shim()
, disable_warning_shim()
### Default search engine is Google # Enable automatic search # NB: This is done automatically on package load. enable_errorist() # Some code ... # Disable automatic search # NB: This is done automatically on package unload via "detach()" disable_errorist() #### Custom search engines # Enable automatic search with custom search engines # NB: This is done automatically on package load. enable_errorist(error_search_func = searcher::search_bing, warning_search_func = searcher::search_duckduckgo) # Some code ... # Disable automatic search # NB: This is done automatically on package unload via "detach()" disable_errorist()
### Default search engine is Google # Enable automatic search # NB: This is done automatically on package load. enable_errorist() # Some code ... # Disable automatic search # NB: This is done automatically on package unload via "detach()" disable_errorist() #### Custom search engines # Enable automatic search with custom search engines # NB: This is done automatically on package load. enable_errorist(error_search_func = searcher::search_bing, warning_search_func = searcher::search_duckduckgo) # Some code ... # Disable automatic search # NB: This is done automatically on package unload via "detach()" disable_errorist()
Add or remove a listener to top-level task callbacks that checks for whether a new warning or error occurs and then triggers a search browser.
enable_warning_shim( warning_search_func = getOption("errorist.warning", searcher::search_google) ) disable_warning_shim() enable_error_shim( error_search_func = getOption("errorist.error", searcher::search_google) ) disable_error_shim()
enable_warning_shim( warning_search_func = getOption("errorist.warning", searcher::search_google) ) disable_warning_shim() enable_error_shim( error_search_func = getOption("errorist.error", searcher::search_google) ) disable_error_shim()
error_search_func , warning_search_func
|
The search function from |
By default, both enable_warning_shim()
and enable_error_shim()
functions
are automatically triggered when the errorist
package is loaded.
The error shim uses R's default handler for errors set by specifying
a function for error
in options()
.
For the warning shim, a top-level task callback added to the environment
via base::addTaskCallback()
. This causes the warning handler to fire
each time a new function call occurs in R regardless of whether it
triggers an error.
James Joseph Balamuta
# Default setup enable_warning_shim() # Some code ... # Remove the shim disable_warning_shim() # Specify a search function enable_warning_shim(warning_search_func = searcher::search_google) # Some code ... # Remove the shim disable_warning_shim() # Enable only the error shim enable_error_shim() # Some code ... # Remove the shim disable_error_shim() # Specify a search function enable_error_shim(error_search_func = searcher::search_google) # Some code ... # Remove the shim disable_error_shim()
# Default setup enable_warning_shim() # Some code ... # Remove the shim disable_warning_shim() # Specify a search function enable_warning_shim(warning_search_func = searcher::search_google) # Some code ... # Remove the shim disable_warning_shim() # Enable only the error shim enable_error_shim() # Some code ... # Remove the shim disable_error_shim() # Specify a search function enable_error_shim(error_search_func = searcher::search_google) # Some code ... # Remove the shim disable_error_shim()