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.
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:
An error message detailing the reason for skipping the file is logged.
The calling function (
seasonder_readSeaSondeCSFile
) will immediately return a list withheader = NULL
anddata = 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
#>