mobxjs / mst-gql

Bindings for mobx-state-tree and GraphQL

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to intercept gql http errors.

dirindon opened this issue · comments

I was looking for a way to intercept errors with https://angular.io/api/common/http/HttpInterceptor
but I failed to find any solution and wasn't able to find anything going thru source code.

This is type of errors I wish to catch core.mjs:6412 ERROR Error: Uncaught (in promise): Error: GraphQL Error (Code: 401):
and I don't believe adding error handling to each of the requests is the way to go, especially to catch simple 401.

Did anyone had similar issue or found a way to handle those errors without writing massive amounts of code to each of the queries ?

@dirindon if I'm understanding correctly, you'd like some kind of top-level way to inspect network requests running through mst-gql?