Capture a message, warning, or error to take actions

e_message_capture(f)

Arguments

f

a function that might return a message, warning, or error

Value

if there was an exception, return its content

Examples

e_message_capture(test_message)(1)
#> [[1]]
#> NULL
#> 
#> $logs
#> $logs[[1]]
#> $logs[[1]]$timestamp
#> [1] "2023-03-24 00:09:08"
#> 
#> $logs[[1]]$type
#> [1] "error"
#> 
#> $logs[[1]]$message
#> [1] "object 'test_message' not found"
#> 
#> 
#>