question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Uncaught error when network connection is disrupted.

See original GitHub issue

Intended outcome:

I’d like to be able to catch errors when a network connection is disrupted.

Actual outcome:

Errors generated when a network connection is disrupted result in an uncaught error: Uncaught (in promise) Error: undefined

How to reproduce the issue:

On a basic working example of an apollo app, disable the network connection in the browser or turn wifi off.

Versions


  System:
    OS: macOS 11.4
  Binaries:
    Node: 14.16.1 - /usr/local/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 8.5.5 - /usr/local/bin/npm
  Browsers:
    Chrome: 101.0.4951.64
    Firefox: 100.0.2
    Safari: 14.1.1
  npmPackages:
    @apollo/client: ^3.6.4 => 3.6.4 

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:2
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
pei-wangcommented, Oct 18, 2022

I encountered this issue too. I mocked a 500 error response for my API call.

I am wondering what’s the appropriate approach for handling this. it does not causes any issue on my functionality, just the error on ReactRefreshWebpackPlugin overlay is annoying me. I can catch the error where I invoke the query, but it makes me replicate the catch to everywhere I use query/mutation.

Was trying to create a custom link to prevent the error pass back since I already handled it on Error link. but it doesn’t work, since the Apollo client expects the result(error) back.

index.js:29 Uncaught (in promise) Error: Response not successful: Received status code 500
    at new ApolloError (index.js:29:1)
    at Object.error (QueryManager.js:141:1)
    at notifySubscription (module.js:137:1)
    at onNotify (module.js:176:1)
    at SubscriptionObserver.error (module.js:229:1)
    at Object.error (asyncMap.js:32:1)
    at notifySubscription (module.js:137:1)
    at onNotify (module.js:176:1)
    at SubscriptionObserver.error (module.js:229:1)
    at iteration.js:4:1
    at Array.forEach (<anonymous>)
    at iterateObserversSafely (iteration.js:4:1)
    at Object.error (Concast.js:37:1)
    at notifySubscription (module.js:137:1)
    at onNotify (module.js:176:1)
    at SubscriptionObserver.error (module.js:229:1)
    ```
2reactions
jpvajdacommented, Sep 30, 2022

@jdgreenberger no updates as of yet. Our team is working on some higher priority things at the moment. Though we accept PRs so if you want to make an attempt to improve the error message here, we’d be happy to review the PR. Just let us know!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How To Fix “Your Connection Was Interrupted A Network ...
The fix applies to you if you have multiple connections. Please disconnect the connection that is giving you the error and connect to...
Read more >
Top 8 Ways to Fix Your Connection Was Interrupted Error on ...
1. Restart Wi-Fi Router · 2. Flush DNS cache · 3. Reset Internet Protocol · 4. Clear Browsing Data · 5. Disable Proxy...
Read more >
Uncaught Error: A network error - Stack Overflow
... I got an uncaught error: a network error (such as timeout, interrupted connection or unreachable host) has occurred.
Read more >
Your connection was interrupted, A network change was ...
Your connection was interrupted · Check Wi-Fi router · Flush DNS cache · Reset Winsock · Check LAN settings · Check if any...
Read more >
XPC connection interrupted | Apple Developer Forums
I need to load a dynamic library use xpc..this library need to display UI.Then console catch error : *** Terminating app due to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found