Skip to contents

This function is a convenience mechanism to invoke the seasonder_skip_cs_field restart option. It can be used in custom condition handlers when reading a CSField from a binary connection encounters an error or condition. When called, it indicates the intention to skip reading the current CSField and return a specific value.

Usage

seasonder_skip_cs_field(cond, value)

Arguments

cond

A condition or error that occurred while reading the CSField.

value

The desired return value to use in place of the CSField reading that encountered an error.

Value

The value specified in the 'value' parameter.

Details

During the execution of the seasonder_readCSField function, errors or conditions can occur. To provide a structured mechanism to handle such cases, the function utilizes the rlang::withRestarts mechanism, offering a restart option named seasonder_skip_cs_field. This restart allows the function to gracefully handle reading errors by logging a relevant error message and returning a specified value.

The seasonder_skip_cs_field function provides an easy way to invoke this restart. When called within a custom condition handler, it signals the intention to skip the current CSField reading due to an error and specifies a return value.

Examples

# Example: Skip reading a CSField using a withRestarts handler to return a default value
r <- withRestarts(
  seasonder_skip_cs_field(simpleError("test error"), "default"),
  seasonder_skip_cs_field = function(cond, value) value
)
print(r)
#> [1] "default"