The companion to is_ggseg_atlas() for code that cannot continue without a
valid atlas. The predicate answers a yes/no question and so has nothing to
say about why an object failed; callers that turned that FALSE into an
error could only report the class, which is the one thing that was usually
fine. assert_ggseg_atlas() separates the two failure kinds:
Usage
assert_ggseg_atlas(x, arg = rlang::caller_arg(x), call = rlang::caller_env())Details
A wrong class is reported as a wrong class.
A
ggseg_atlaswhose parts do not satisfy the schema aborts with theggseg_atlas()constructor's own diagnostic, chained as the parent error, so the reader sees the missing column, the duplicated label or the mismatched data class instead of a message about the class tag.
Prefer this wherever a bad atlas would otherwise propagate; keep
is_ggseg_atlas() for control flow, where signalling is wrong.
