ENH: add functools.wraps to preserve operation name in error message