Search code examples
javascriptvuexfeathersjs

Catch all errors clientside sent from any service


I want to write a vuejs component that displays any errors from the server but I don't want to have to call it in every catch of every service call. How can I simply catch every error sent to the client?

Thanks.

I'm using feathers-vuex and want to handling through that if possible and not pure javascript.


Solution

  • You can handle all errors returned form the Feathers API in an Application level error hook of the Feathers client application:

    feathersClient.hooks({
      error (context) {
        showErrorPopup(error.message);
      }
    });