tryKeepConditions {AnalysisPageServer} | R Documentation

## tryKeepConditions

### Description

Try-catch wrapper, keeping error traceback and conditions

### Usage

    tryKeepConditions(expr)

### Arguments

`expr` | Expression to evaluate

### Details

This is a try-catch wrapper. It returns a list with four elements:

`$value`

  The value of the evaluated expression, or NULL if an error was thrown and execution did not complete

`$messages`

  A list of `message` objects, each being a message thrown during the execution, in order

`$warnings`

  A list of `condition` objects, each being a message thrown during the execution, in order

`$error`

  NULL if there was no error, otherwise the `error` object, which can then be passed to `getTraceback` to retrieve the error

The elements of the `$messages`, `$warnings` and `$error` are all actually two-element lists, the first being the condition object itself (named `$message`, `$warning` or `$error`) and the second begin the call stack as returned by `sys.calls()` and named `$calls`.

The class of this object is set as "AnalysisPageValueWithConditions"

### Value

AnalysisPageValueWithConditions

### Author(s)

Brad Friedman

### See Also

`vwc.is.error`

`vwc.conditions` `vwc.error` `vwc.error.condition` `vwc.error.traceback` `vwc.is.error` `vwc.messages` `vwc.messages.conditions` `vwc.messages.tracebacks` `vwc.n` `vwc.n.messages` `vwc.n.warnings` `vwc.tracebacks` `vwc.value` `vwc.warnings` `vwc.warnings.conditions` `vwc.warnings.tracebacks`

### Examples

    value.with.warning <- tryKeepConditions({warning("warning message"); 3})
    value.with.error <- tryKeepConditions({stop("err message")})

[Package AnalysisPageServer version 1.21.0 Index]