-
Notifications
You must be signed in to change notification settings - Fork 62
Open
Description
We (possibly weirdly) combine this library with React-Relay-offline to persist queries to local/async storage.
I was trying to prevent the middlewares completing in the event of an error, so that the cache isn't updated. My last middleware function ("last" meaning furthest from the fetch result) looks like this
export const blockCacheOnErrorMiddleware = () => (next: MiddlewareNextFn) => async (
req: RelayRequestAny
) => {
const res = await next(req)
// simple fn to grab the error from either a batch or single response
const error = getFirstErrorFromRes(res)
if (error) {
return new Error('Error received from Relay response')
}
return res
}
This works great for what I need as far as I can tell. However, I am getting (unsurprisingly) an unhandled Promise exception in the console:
backend.js:32 Possible Unhandled Promise Rejection (id: 0):
RelayNetwork: No data returned for operation `ExampleQuery`, got error(s):
(No errors)
Is there a better way of handling this situation? I had a look at your example source code and couldn't see any similar use-cases
Metadata
Metadata
Assignees
Labels
No labels