Apollo 查询订阅错误中没有扩展部分

问题描述 投票:0回答:1

订阅回调仅提供基本错误消息,缺少错误代码和类型等其他详细信息,而网络选项卡显示结构正确的错误数组,这表明订阅未传输完整的错误对象

我尝试了一些改变

angular graphql apollo
1个回答
0
投票
Add errorPolicy: 'all' in your query it will resolve your issue and will provide proper error like this:
[result][1]

    this.apollo.watchQuery({
      query: GET_DATA,
      **errorPolicy: 'all',** // Set the desired error policy here
    })
   .subscribe({ //and handle this subscription part according to your version
      next: (result) => {
        // Handle successful response
      },
      error: (error) => {
        // Handle error
      }
    });

  [1]: https://i.stack.imgur.com/RTqZ0.png
© www.soinside.com 2019 - 2024. All rights reserved.