0

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.

Iglo
  • 706
  • 2
  • 8
  • 17
  • Possible duplicate of [Get all javascript errors on page/javascript error handling](https://stackoverflow.com/questions/6970475/get-all-javascript-errors-on-page-javascript-error-handling) – adiga Feb 01 '19 at 09:34

1 Answers1

1

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);
  }
});
Daff
  • 43,734
  • 9
  • 106
  • 120