-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
James Lamb
committed
May 16, 2018
1 parent
775d1a4
commit 97e6199
Showing
6 changed files
with
83 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,7 @@ Description: | |
Depends: | ||
R (>= 3.3.0) | ||
Imports: | ||
assertthat (>= 0.2.0), | ||
data.table, | ||
futile.logger, | ||
httr, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
|
||
# [title] assert_that wrapper | ||
# [name] assert | ||
# [description] When making an assertion you might call: | ||
# | ||
# \code{assertthat::assert_that(assertthat::is.date(x))} | ||
# | ||
# or something like that. This is an alias to \code{\link[assertthat]{assert_that}} to be used | ||
# for two benefits: \enumerate{ | ||
# \item{This uses \code{\link{log_fatal}} instead of \code{\link{stop}} on failure} | ||
# \item{Much less clutter in the source code} | ||
# } | ||
#' @importFrom assertthat see_if | ||
.assert <- function(..., msg = NULL) { | ||
res <- assertthat::see_if(..., env = parent.frame(), msg = msg) | ||
if (res) { | ||
return(invisible(TRUE)) | ||
} else { | ||
log_fatal(attr(res, "msg")) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters