Skip to contents

This function serves as a restart for seasonder_readSeaSondeCSFile. When invoked, it provides a mechanism to gracefully handle file reading errors by logging an error message and skipping the current file processing.

Usage

seasonder_skip_cs_file(cond)

Arguments

cond

The condition or error that occurred during the file reading process. This is used to log a detailed error message indicating the reason for skipping the file.

Value

A list with header = NULL and data = NULL.

Details

This function is meant to be used within a custom condition handler. When a problematic condition arises during the processing of a SeaSonde CS file, you can call seasonder_skip_cs_file(cond) to trigger this restart, which allows for a graceful degradation by logging an error message and returning a specified value.

The effect of invoking this restart is twofold:

  1. An error message detailing the reason for skipping the file is logged.

  2. The calling function (seasonder_readSeaSondeCSFile) will immediately return a list with header = NULL and data = NULL.

Examples

# Example: Skip file reading using a withRestarts handler to return NULL header and data
result <- withRestarts(
  seasonder_skip_cs_file(simpleError("test error")),
  seasonder_skip_cs_file = function(cond) list(header = NULL, data = NULL)
)
print(result)
#> $header
#> NULL
#> 
#> $data
#> NULL
#>