has.error {quickcode}R Documentation

Check if a call or expression produces errors

Description

Whether a function or series of calls results in error

Usage

has.error(...)

Arguments

...

the expression or function calls

Value

boolean value to indicate if the expression produces errors

Note

More information, check: https://rpkg.net/package/quickcode

Examples

# this should not produce error
# so the function result should be FALSE
has.error({
  x = 8
  y = number(10)
  res = x + y
})

# this should produce the following error
# Error in x + y : non-numeric argument to binary operator
# so the function result should be TRUE
has.error({
  x = 8
  y = "random"
  res = x + y
})

# this should result in error because
# the dataset does not contain a "rpkg.net" column
# the result should be TRUE
df1 = mtcars
has.error(df1[,"rpkg.net"])


[Package quickcode version 0.9.1 Index]