Caching and error handling

Hi!

I was wondering how to make the cache NOT write when there is an error in the graph ql response. Error Handling - Apollo GraphQL Docs

The reason to not write responses that contains errors are the it could overwrite a succesful response.

Any ides on this?