DavisVaughan / furrr

Apply Mapping Functions in Parallel using Futures
https://furrr.futureverse.org/
Other
695 stars 39 forks source link

Error indices from purrr() are misleading in furrr() #250

Open alexpghayes opened 1 year ago

alexpghayes commented 1 year ago
library(purrr)
library(furrr)
#> Loading required package: future

plan(multisession, workers = 20)

fails_at_index <- function(index, failure_index = 100) {
  if (index == failure_index) {
    stop("Grompy")
  }

  "Happy"
}

# helpful error message
map(1:200, fails_at_index)
#> Error in `map()`:
#> ℹ In index: 100.
#> Caused by error in `.f()`:
#> ! Grompy

# misleading error message
future_map(1:200, fails_at_index)
#> Error:
#> ℹ In index: 10.
#> Caused by error in `...furrr_fn()`:
#> ! Grompy

Created on 2023-02-15 with reprex v2.0.2.9000