The useQuery hook’s opts have an onError property that accepts a callback.
I also don’t see anything about union types. That definitely seems like the hardest thing to reverse construct based on usage, since the underlying proxy wouldn’t know what you’re doing with __typename.