Skip to content

expect_no_error() loses traceback #2334

Description

@hadley

e.g.

Failure ([test-dbplyr.R:57:3](vscode-file://vscode-app/Applications/Positron.app/Contents/Resources/app/out/vs/code/electron-browser/workbench/workbench.html#)): joins, semi_joins, and set ops work
Expected `dplyr::collect(dplyr::semi_join(db1, db2, by = "x"))` not to throw any errors.
Actually got a <simpleError> with message:
  no applicable method for 'table_path_components' applied to an object of class "c('Pool', 'R6')"

Having the traceback is very useful.

Activity

  1. hadley commented on Sep 14, 2026

    @hadley
    MemberAuthor

    Here's a reprex:

    library(testthat)
    
    f <- function() g()
    g <- function() stop("boom")
    
    # I want this:
    test_that("test", { 
      f()
    })
    # ── Error: test ───────────────
    # Error in `g()`: boom
    # Backtrace:
    #     ▆
    #  1. └─global f()
    #  2.   └─global g()
    
    # But I get this 
    test_that("test", { 
      expect_no_error(f())
    })
    # Expected `f()` not to throw any errors.
    # Actually got a <simpleError> with message:
    #  boom
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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