latch: Latch an Error or a Warning

Description Usage Arguments Functions Examples

Description

Latch an error or a warning to an object to indicate an issue associated with it. These can later be checked with is.e() and is.w(), and can also be resolve().

Usage

1
2
3
4
5
latch.e(obj, error)

latch.w(obj, warning)

unlatch(obj)

Arguments

obj

Object to latch the error or warning onto.

error, warning

Error or warning, the output of e() or w().

Functions

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
x <- 1
problematic <- latch.e(x, e("Not right"))

is.e(problematic)

do_sth_with_x <- function(x){
 resolve(x)
 x + 1
}

if(interactive()){
 do_sth_with_x(x)
 do_sth_with_x(problematic)
}

unlatch(problematic)

erratum documentation built on Jan. 4, 2022, 1:08 a.m.