xbioclim mirrors the SpatMessages pattern from the terra package to
provide a clean mechanism for propagating error and warning messages across
the C++/R boundary.
How the cross-boundary workflow works:
A C++ routine performs its computation and, instead of throwing directly, records any error or warning strings into a session-level message store.
After every
.Call()invocation, the R-side wrapper callscheck_messages()to inspect the store and re-raise any messages as native R conditions (stop()for errors,warning()for warnings).Users can also inspect the store directly with
bioclim_errors()andbioclim_warnings()before R conditions are raised, or clear it withclear_messages().
Functions available to users:
bioclim_errors()– retrieve stored error messages.bioclim_warnings()– retrieve stored warning messages.has_error()–TRUEif at least one error is stored.has_warning()–TRUEif at least one warning is stored.clear_messages()– discard all stored messages.
Functions used internally (and by future C++ glue code):
push_error()– store an error message.push_warning()– store a warning message.check_messages()– raise stored messages as R conditions and clear them.
Value
No return value; this page documents the internal message store.
bioclim_errors() and bioclim_warnings() return character vectors,
has_error() and has_warning() return logicals, and
clear_messages() returns NULL invisibly.