
const feathersErrors = require('@feathersjs/errors');

const errors = feathersErrors.errors;

module.exports = function (...providers) {
  return context => {
    const hookProvider = (context.params || {}).provider;

    const anyProvider = providers.length === 0;
    const thisProvider = providers.some(provider =>
      provider === hookProvider ||
      (provider === 'server' && !hookProvider) ||
      (provider === 'external' && !!hookProvider)
    );

    if (anyProvider || thisProvider) {
      throw new errors.MethodNotAllowed(
        `Provider '${context.params.provider}' can not call '${context.method}'. (disallow)`
      );
    }
  };
};


const feathersErrors = require('@feathersjs/errors');

const errors = feathersErrors;

module.exports = function (...providers) {
  return context => {
    const hookProvider = (context.params || {}).provider;

    const anyProvider = providers.length === 0;
    const thisProvider = providers.some(provider =>
      provider === hookProvider ||
      (provider === 'server' && !hookProvider) ||
      (provider === 'external' && !!hookProvider)
    );

    if (anyProvider || thisProvider) {
      throw new errors.MethodNotAllowed(
        `Provider '${context.params.provider}' can not call '${context.method}'. (disallow)`
      );
    }
  };
};

Fix feathersErrors.errors === undefined error
Fix feathersErrors.errors === undefined error

The errors reside on the feathersErrors object itself. No need to address the property errors here.