bodkan/slendr

Look into nicer reporting of errors after recent purrr changes

bodkan opened this issue · 0 comments

It appears some update to the purrr package has made functional iteration like map and friends try to be smarter (?) in reporting potential errors. This leads to cluttered error messages like this (from the tree sequence vignette):

> schedule_sampling(model, times = 10000, list(nea, 1), strict = TRUE)
Error in `map()`:
ℹ In index: 1.
Caused by error in `map()`:
ℹ In index: 1.
Caused by error:
! Cannot schedule sampling for 'NEA' at time 10000 because the population will not yet be present
in the simulation at that point. Consider running this function with `strict = FALSE` which will
automatically retain only valid sampling events.
Run `rlang::last_error()` to see where the error occurred.

I'm really not a fan of this as I preferred a simple error message being returned, instead of the purrr stacktraces or whatever it is that they have started reporting now. This completely drowns the (deliberately very simple) error reporting that I've designed here.

Action: check the purrr changelog for a way to disable this.