我正在学习 React/Apollo,当我引入错误时,我的 Chrome 控制台中出现了典型的红色异常。但是,对于 Apollo,它并没有告诉我错误在我的代码中从哪里开始,就像在 React 或其他框架中一样。当使用在多个组件中触发查询的钩子时,查找问题根源的速度非常慢。
您是否使用任何技巧来调试您的 Apollo 代码,或者您能以某种方式改进错误反馈?
这是我看到的:
ApolloError.ts:46 Uncaught (in promise) Error: GraphQL error: User is not authenticated
at new ApolloError (ApolloError.ts:46)
at QueryManager.ts:1241
at Object.next (Observable.js:322)
at notifySubscription (Observable.js:135)
at onNotify (Observable.js:179)
at SubscriptionObserver.next (Observable.js:235)
at observables.ts:12
at Set.forEach (<anonymous>)
at Object.next (observables.ts:12)
at notifySubscription (Observable.js:135)
at onNotify (Observable.js:179)
at SubscriptionObserver.next (Observable.js:235)
at httpLink.ts:142