diff --git a/apple-touch-icon-120x120.png b/apple-touch-icon-120x120.png index fba0487..859368d 100644 Binary files a/apple-touch-icon-120x120.png and b/apple-touch-icon-120x120.png differ diff --git a/apple-touch-icon-152x152.png b/apple-touch-icon-152x152.png index b14162f..155ec25 100644 Binary files a/apple-touch-icon-152x152.png and b/apple-touch-icon-152x152.png differ diff --git a/apple-touch-icon-180x180.png b/apple-touch-icon-180x180.png index 5fe1d2a..fbfa6e1 100644 Binary files a/apple-touch-icon-180x180.png and b/apple-touch-icon-180x180.png differ diff --git a/apple-touch-icon-60x60.png b/apple-touch-icon-60x60.png index 789f6d6..6658a3b 100644 Binary files a/apple-touch-icon-60x60.png and b/apple-touch-icon-60x60.png differ diff --git a/apple-touch-icon-76x76.png b/apple-touch-icon-76x76.png index 48107e0..e8951a5 100644 Binary files a/apple-touch-icon-76x76.png and b/apple-touch-icon-76x76.png differ diff --git a/apple-touch-icon.png b/apple-touch-icon.png index 5fe1d2a..fbfa6e1 100644 Binary files a/apple-touch-icon.png and b/apple-touch-icon.png differ diff --git a/favicon-16x16.png b/favicon-16x16.png index 0735a07..6f41645 100644 Binary files a/favicon-16x16.png and b/favicon-16x16.png differ diff --git a/favicon-32x32.png b/favicon-32x32.png index 71a4314..54ba1f7 100644 Binary files a/favicon-32x32.png and b/favicon-32x32.png differ diff --git a/index.html b/index.html index 0ed2583..7fed72e 100644 --- a/index.html +++ b/index.html @@ -72,11 +72,10 @@ -
The goal of slap is to …
+The goal of slap is simplify error handling.
@@ -87,9 +86,13 @@library(dplyr)
library(slap)
+# suppose you have a function that throws an error
boom <- function() stop("An error occured in boom()")
+# and you want to use it in e.g. dplyr::summarise()
+# summarise(mtcars, mpg = boom())
-# instead of:
+# if you want to catch it and rethrow an error that is more
+# meaningful to you, one way is to use withCallingHandlers()
withCallingHandlers(
summarise(mtcars, mpg = boom()),
error = function(err) {
@@ -97,11 +100,11 @@ Example
}
)
-# just use the slap operator, i.e. %!%
+# but that's kind of boring, so instead you can use the
+# slap operator %!% to slap away the eror
summarise(mtcars, mpg = boom()) %!% "ouch"
-# or use the double slap operator for simpler error
-# i.e. without keeping the parent error
+# or the double slap operator %!!% if you don't want to keep the parent error
summarise(mtcars, mpg = boom()) %!!% "ouch"
diff --git a/pkgdown.yml b/pkgdown.yml
index 5b2ecce..1620c30 100644
--- a/pkgdown.yml
+++ b/pkgdown.yml
@@ -2,7 +2,7 @@ pandoc: 3.1.11
pkgdown: 2.0.9
pkgdown_sha: ~
articles: {}
-last_built: 2024-04-21T09:55Z
+last_built: 2024-04-21T10:01Z
urls:
reference: https://slap.tada.science/reference
article: https://slap.tada.science/articles
diff --git a/search.json b/search.json
index 86b9710..9c902c0 100644
--- a/search.json
+++ b/search.json
@@ -1 +1 @@
-[{"path":"https://slap.tada.science/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"MIT License","title":"MIT License","text":"Copyright (c) 2024 tada.science Permission hereby granted, free charge, person obtaining copy software associated documentation files (“Software”), deal Software without restriction, including without limitation rights use, copy, modify, merge, publish, distribute, sublicense, /sell copies Software, permit persons Software furnished , subject following conditions: copyright notice permission notice shall included copies substantial portions Software. SOFTWARE PROVIDED “”, WITHOUT WARRANTY KIND, EXPRESS IMPLIED, INCLUDING LIMITED WARRANTIES MERCHANTABILITY, FITNESS PARTICULAR PURPOSE NONINFRINGEMENT. EVENT SHALL AUTHORS COPYRIGHT HOLDERS LIABLE CLAIM, DAMAGES LIABILITY, WHETHER ACTION CONTRACT, TORT OTHERWISE, ARISING , CONNECTION SOFTWARE USE DEALINGS SOFTWARE.","code":""},{"path":"https://slap.tada.science/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Romain François. Author, maintainer. tada.science. Copyright holder, funder.","code":""},{"path":"https://slap.tada.science/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"François R (2024). slap: Slap Light Alternative Plight. R package version 0.0.0.9000, http://tada.science/slap/, https://github.com/tadascience/slap.","code":"@Manual{, title = {slap: Slap Light Alternative Plight}, author = {Romain François}, year = {2024}, note = {R package version 0.0.0.9000, http://tada.science/slap/}, url = {https://github.com/tadascience/slap}, }"},{"path":"https://slap.tada.science/index.html","id":"slap-","dir":"","previous_headings":"","what":"Slap Light Alternative Plight","title":"Slap Light Alternative Plight","text":"goal slap …","code":""},{"path":"https://slap.tada.science/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Slap Light Alternative Plight","text":"can install development version slap like :","code":"pak::pak(\"tadascience/slap\")"},{"path":"https://slap.tada.science/index.html","id":"example","dir":"","previous_headings":"","what":"Example","title":"Slap Light Alternative Plight","text":"","code":"library(dplyr) library(slap) boom <- function() stop(\"An error occured in boom()\") # instead of: withCallingHandlers( summarise(mtcars, mpg = boom()), error = function(err) { cli::cli_abort(\"ouch\", parent = err) } ) # just use the slap operator, i.e. %!% summarise(mtcars, mpg = boom()) %!% \"ouch\" # or use the double slap operator for simpler error # i.e. without keeping the parent error summarise(mtcars, mpg = boom()) %!!% \"ouch\""},{"path":"https://slap.tada.science/reference/slap.html","id":null,"dir":"Reference","previous_headings":"","what":"Slap Operator — slap","title":"Slap Operator — slap","text":"Slap Operator","code":""},{"path":"https://slap.tada.science/reference/slap.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Slap Operator — slap","text":"","code":"expr %!% message expr %!!% message"},{"path":"https://slap.tada.science/reference/slap.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Slap Operator — slap","text":"expr expression quosure evaluate. message formatted via call cli_bullets().","code":""},{"path":"https://slap.tada.science/reference/slap.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Slap Operator — slap","text":"","code":"g <- function() { stop(\"ouch\") } f <- function(error_call = current_env()) { g() %!% \"bam\" } h <- function() { rlang::local_error_call(quote(foo())) g() %!% \"bam\" } if (FALSE) { f() h() }"}]
+[{"path":"https://slap.tada.science/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"MIT License","title":"MIT License","text":"Copyright (c) 2024 tada.science Permission hereby granted, free charge, person obtaining copy software associated documentation files (“Software”), deal Software without restriction, including without limitation rights use, copy, modify, merge, publish, distribute, sublicense, /sell copies Software, permit persons Software furnished , subject following conditions: copyright notice permission notice shall included copies substantial portions Software. SOFTWARE PROVIDED “”, WITHOUT WARRANTY KIND, EXPRESS IMPLIED, INCLUDING LIMITED WARRANTIES MERCHANTABILITY, FITNESS PARTICULAR PURPOSE NONINFRINGEMENT. EVENT SHALL AUTHORS COPYRIGHT HOLDERS LIABLE CLAIM, DAMAGES LIABILITY, WHETHER ACTION CONTRACT, TORT OTHERWISE, ARISING , CONNECTION SOFTWARE USE DEALINGS SOFTWARE.","code":""},{"path":"https://slap.tada.science/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Romain François. Author, maintainer. tada.science. Copyright holder, funder.","code":""},{"path":"https://slap.tada.science/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"François R (2024). slap: Slap Light Alternative Plight. R package version 0.0.0.9000, http://tada.science/slap/, https://github.com/tadascience/slap.","code":"@Manual{, title = {slap: Slap Light Alternative Plight}, author = {Romain François}, year = {2024}, note = {R package version 0.0.0.9000, http://tada.science/slap/}, url = {https://github.com/tadascience/slap}, }"},{"path":"https://slap.tada.science/index.html","id":"slap-","dir":"","previous_headings":"","what":"Slap Light Alternative Plight","title":"Slap Light Alternative Plight","text":"goal slap simplify error handling.","code":""},{"path":"https://slap.tada.science/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Slap Light Alternative Plight","text":"","code":"pak::pak(\"tadascience/slap\")"},{"path":"https://slap.tada.science/index.html","id":"example","dir":"","previous_headings":"","what":"Example","title":"Slap Light Alternative Plight","text":"","code":"library(dplyr) library(slap) # suppose you have a function that throws an error boom <- function() stop(\"An error occured in boom()\") # and you want to use it in e.g. dplyr::summarise() # summarise(mtcars, mpg = boom()) # if you want to catch it and rethrow an error that is more # meaningful to you, one way is to use withCallingHandlers() withCallingHandlers( summarise(mtcars, mpg = boom()), error = function(err) { cli::cli_abort(\"ouch\", parent = err) } ) # but that's kind of boring, so instead you can use the # slap operator %!% to slap away the eror summarise(mtcars, mpg = boom()) %!% \"ouch\" # or the double slap operator %!!% if you don't want to keep the parent error summarise(mtcars, mpg = boom()) %!!% \"ouch\""},{"path":"https://slap.tada.science/reference/slap.html","id":null,"dir":"Reference","previous_headings":"","what":"Slap Operator — slap","title":"Slap Operator — slap","text":"Slap Operator","code":""},{"path":"https://slap.tada.science/reference/slap.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Slap Operator — slap","text":"","code":"expr %!% message expr %!!% message"},{"path":"https://slap.tada.science/reference/slap.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Slap Operator — slap","text":"expr expression quosure evaluate. message formatted via call cli_bullets().","code":""},{"path":"https://slap.tada.science/reference/slap.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Slap Operator — slap","text":"","code":"g <- function() { stop(\"ouch\") } f <- function(error_call = current_env()) { g() %!% \"bam\" } h <- function() { rlang::local_error_call(quote(foo())) g() %!% \"bam\" } if (FALSE) { f() h() }"}]