def decorate_check_error(error_enum):
  """Decorator to call `check_error` on the return value."""
  def decorator(func):
    @functools.wraps(func)
    def _check_error(*args, **kwargs):
      return check_error(func(*args, **kwargs), error_enum)
    return _check_error
  return decorator