Errors: store a call or NULL in cond$call#413
Merged
gaborcsardi merged 2 commits intomainfrom Apr 20, 2026
Merged
Conversation
Three changes in `standalone-errors.R`:
1. Instead of storing the raw deparsed string in `$call`, re-parse
it via `str2lang()` to produce a compact call object. For multiline
calls that can't round-trip (e.g. `withCallingHandlers({...})`), the
fallback is `f(...)` — the function head with `...` as the sole argument.
This keeps `$call` always a proper call object or `NULL`, so
`conditionCall()` and rlang work correctly without any custom
S3 method. Because rlang does not use `conditionCall()`.
2. **`frame_call()`** — replace the fragile `delayedAssign()/sys.call()`
trick with a straightforward search.
3. **Format functions** — use `conditionCall(x)` consistently instead of
`x[["call"]]` directly, so the error header and trace formatting
both go through the standard accessor.
Closes #360.
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.
Three changes in
standalone-errors.R:Instead of storing the raw deparsed string in
$call, re-parse it viastr2lang()to produce a compact call object. For multiline calls that can't round-trip (e.g.withCallingHandlers({...})), the fallback isf(...)— the function head with...as the sole argument. This keeps$callalways a proper call object orNULL, soconditionCall()and rlang work correctly without any custom S3 method. Because rlang does not useconditionCall().frame_call()— replace the fragiledelayedAssign()/sys.call()trick with a straightforward search.Format functions — use
conditionCall(x)consistently instead ofx[["call"]]directly, so the error header and trace formatting both go through the standard accessor.Closes #360.