Question
How can I react to Apollo errors in my components?
I'd like for example to display a red banner if a "network offline" error was thrown; or show a modal if an error of a certain type is displayed; or render a <Redirect>
(from react-routed-dom
) if another kind of error is thrown.
What I tried
I read the documentation chapter about error handling but it only explains how to setup an Apollo link that acts as a middleware to requests in order to catch errors there. As far as I know it's not possible to pass data from that link down to components given that it's a terminating link.
I tried to use error boundary components but it seems like Apollo errors are not really thrown. Not even when using the await
syntax.