This might seem a little strange, but I think cause as an argument name to Wrap and Wrapf is unnecessary. I wonder if err might be good enough?
Here are some reasons:
- it's obvious that we're wrapping an error that caused the need to add context in the first place
- there's only one argument of type
error
- it is possible the argument is not the 'root' cause, so in a sense, isn't the 'cause'
- IDE plugins will autofil and most of the time, the variable name would be
err so you could just tab past it
Very minor issue, and mainly I'm trying to save myself two key-presses each time I use this (which I will every day).
This might seem a little strange, but I think
causeas an argument name toWrapandWrapfis unnecessary. I wonder iferrmight be good enough?Here are some reasons:
errorerrso you could just tab past itVery minor issue, and mainly I'm trying to save myself two key-presses each time I use this (which I will every day).