function _orFailError(err, query) {
  if (typeof err === 'function') {
    err = err.call(query);
  }

  if (err == null) {
    err = new DocumentNotFoundError(query.getQuery(), query.model.modelName);
  }

  return err;
}
Get the error to throw for `orFail()`
@param {Error|undefined} err
@param {Query} query
@api private