1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
message("TESTING: throw()...")
library("R.oo")
## Generate an error
ex <- tryCatch({
stop("An error")
}, error = function(ex) {
ex
})
print(ex)
## Re-throw the error
ex2 <- tryCatch({
throw(ex)
}, error = function(ex) {
ex
})
print(ex2)
stopifnot(identical(ex2, ex))
## Generate an Exception
ex <- tryCatch({
throw("An error")
}, error = function(ex) {
ex
})
print(ex)
## Re-throw the Exception
ex2 <- tryCatch({
throw(ex)
}, error = function(ex) {
ex
})
print(ex2)
stopifnot(identical(ex2, ex))
message("TESTING: throw()...DONE")
|