Inspects the internal message store, issues any recorded warnings via
base::warning(), clears them, then raises any recorded error via
base::stop() and clears it. This function is called automatically by
every R wrapper function immediately after invoking a C++ routine, matching
the pattern used by the terra package.