webmockr v2: another day, another stub
webmockr v2 is here. You can find the source at https://github.com/ropensci/webmockr, and the docs at https://docs.ropensci.org/webmockr. There’s some big changes in this version; most importantly a breaking change, thus the major version change this time. Here’s a run down of the important items in this release. Installation pak::pak("webmockr") The breaking change: error handling Previous to v2 when stubs were constructed starting with stub_request() if an error occurred in a pipe chain, or non-pipe flow, the stub created prior to the error remained. This was not correct behavior from a logical perspective - i.e., one would expect if an error occurred that the thing they were trying to do did not stick around. The new behavior as of v2 deletes the stub upon any error during its creation. Under the hood we’re using withCallingHandlers() to handle different types of errors, throw warnings, etc. For example, wi_th() only accepts types list and partial, so fails with this code: ...