-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can networkerror be catched first #6626
Comments
You can catch a 401 also on the client part itself. In link field you can use OnError
|
@maapteh my code has it. But, in createHttpLink.ts, it call |
I think its related to #6612 because the error is lost in SSR calls. For client side calls i indeed not get the error (in link), but i do get it on component .
i added a page to my sandbox repo to show your scenario on it as well |
@maapteh my scenario is in client side. In my application, server is nodejs. // server
ctx.status = 403
throw new Error('no authenticate') then, i will get graphQLErrors in onError. In my app, it has 401, 403, 405 and has same error message. so i can't distinguish errors based on error message. |
instead of AuthenticationError, did you play with ApolloError? ApolloError accepts errorCode (string).
|
@maapteh got it. I will try. thanks. |
it can solve my problem. i will close issue. |
when I set http code is 401, and throw new error in server. In chrome network, I get http code is 401 and response data is:
see,https://github.com/apollographql/apollo-client/blob/master/src/link/http/createHttpLink.ts#L142-L170, I get graphqlError not networkError, I can't get 401.
The text was updated successfully, but these errors were encountered: