print(ERRVL(1,2,3)) # 1
print(ERRVL(try(solve(0)),2,3)) # 2
print(ERRVL(1, stop("Error!"))) # No error
if (FALSE) {
# Error:
print(ERRVL(try(solve(0), silent=TRUE),
stop("Error!")))
}
# Capture and print the try-error object:
ERRVL(try(solve(0), silent=TRUE),
print(paste0("Stopped with an error: ", .)))
print(ERRVL2(1,2,3)) # 1
print(ERRVL2(solve(0),2,3)) # 2
print(ERRVL2(1, stop("Error!"))) # No error
if (FALSE) {
# Error:
ERRVL3(solve(0), stop("Error!"))
}
# Capture and print the error object:
ERRVL3(solve(0), print(paste0("Stopped with an error: ", .)))
# Shorthand for tryCatch(expr, error = function(e) e):
ERRVL3(solve(0), .)
Run the code above in your browser using DataLab