Skip to content

Two potential issues related to rlang errors and backtraces #2313

@DavisVaughan

Description

@DavisVaughan

Two rlang snapshot tests are failing with new testthat

══ Failed tests ════════════════════════════════════════════════════════════════
── Failure ('test-c-api.R:1299:3'): re-encoding fails purposefully with any bytes ──
Snapshot of code has changed:
old vs new
  Code
    r_obj_encode_utf8(bytes)
- Condition <rlang_error>
+ Condition <simpleError>
    Error in `r_obj_encode_utf8()`:
    ! translating strings with "bytes" encoding is not allowed

── Failure ('test-cnd-entrace.R:415:3'): can call `global_entrace()` in knitted documents ──
Snapshot of code has changed:
     old                           | new                                        
[11]                               |                                        [11]
[12]       f()                     |       f()                              [12]
[13]                               |                                        [13]
[14]       ## Error in h(do): foo  -       ## Error in `h()`:               [14]
                                   -       ## ! foo                         [15]
                                   -       ## Backtrace:                    [16]
                                   -       ##     x                         [17]
                                   -       ##  1. \-rlang (local) f()       [18]
                                   -       ##  2.   \-rlang (local) g(do)   [19]
                                   -       ##  3.     \-rlang (local) h(do) [20]
[15]                               |                                        [21]
[16]       rlang::global_entrace() |       rlang::global_entrace()          [22]
[17]                               |                                        [23]

@lionel- mentioned that the first might have something to do with you unwrapping rlang errors into base errors? Is that done unconditionally? It seems like if it started as an rlang error then it should not get unwrapped?

The second seems to have something to do with some new backtrace capturing? Ironically I think this was an example where we wanted to force the base R specific error for testing global_entrace()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions