Open DarwinAwardWinner opened 4 years ago
Thanks for the tip. Will fix ASAP
I am closing the issue, as the feature has been merged to the main repo. Feel free to open another one if you notice some other strange behavior.
One minor note: it's generally good practice (as I've learned in the time since reporting this issue) to call on.exit
with add = TRUE
. This ensures that if you ever add a 2nd on.exit
in the same function for unrelated reasons, both expressions will get run. Otherwise the 2nd one will override the first.
Btw, I think this issue can be closed now. It looks like the PR merge didn't auto-close it.
It looks like
politely
callsoptions
to set the user agent prior to running the wrapped function and then callsoptions
again afterward to restore the previous value. However, if the wrapped function throws an error, the second call tooptions
never happens and the user agent is not restored. I believe the correct way to handle this is withon.exit
, e.g.: