Repository navigation
feat: Give with_pattern() and registry conditions classes - #138
Merged
Merged
Conversation
* `with_pattern()`'s "one value per area" (and `pool` length) errors have class `"gridpattern_area_mismatch"` with fields `arg`, `n_expected`, `n_given`, and `unit` (also the parent of the error raised when drawing with `delay = TRUE`). * Its error for a `pool` with areas of more than one grob has class `"gridpattern_pool_mismatch"`. * Unknown pattern names (and unregistered preferred patterns) raise `"gridpattern_unknown_pattern"`, ambiguous ones `"gridpattern_ambiguous_pattern"`, and `register_pattern()`'s conflict messages have class `"gridpattern_pattern_conflict"` (each with field `pattern`). * A missing suggested package raises `rlang::check_installed()`'s error (`"rlib_error_package_not_found"`) without offering to install it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Gives classes to the conditions a caller (e.g.
{ggpattern}) may want to catch, re-raise, or muffle.New condition classes
gridpattern_area_mismatchwith_pattern(): a pattern parameter (orpool) with the wrong number of values per areaarg,n_expected,n_given,unit("area","grob", or"pool")gridpattern_pool_mismatchwith_pattern(): apoolwith areas of more than one grobgridpattern_unknown_pattern"owner::name"pattern that isn't registeredpattern(the name that couldn't be resolved)gridpattern_ambiguous_patternpatterngridpattern_pattern_conflictregister_pattern()'s conflict / masking messagespatternWith
delay = TRUEthe area check runs at drawing time. The classed error is then theparentof the "couldn't be filled when it was drawn" error.rlang::try_fetch()andexpect_error(class =)still find it there; basetryCatch()doesn't.Other changes
rlang::check_installed()'s error (rlib_error_package_not_found) instead of a custom one. Its offer to install the package is turned off because the patterns check while being drawn. The message wording changes to rlang's.abort_unknown_pattern()as its call.merge_shapes()guard now says "pooled" instead of "grouped".{ggpattern}can require it.Message text is otherwise unchanged. The tests check each class and its fields, and the full suite passes locally (2015 tests).
🤖 Generated with Claude Code