Error handling 如何从Apollo/GraphQL捕获错误

Error handling 如何从Apollo/GraphQL捕获错误,error-handling,graphql,react-apollo,graphcool,Error Handling,Graphql,React Apollo,Graphcool,我使用GraphTool作为后端,但是有一个bug,短期内无法修复 对文件模式进行删除变异将始终抛出此错误(不是什么大问题): “GraphQL错误:哎呀。看起来像是内部服务器错误。请通过控制台()或电子邮件与我们联系。”(support@graph.cool)并包括您的请求ID:“ 调用正常,但我需要在调用后访问更新功能,由于错误,我无法访问。 两种解决方案: 1.捕获graphql错误,以便我可以访问更新:函数,我如何才能做到这一点? 2.不使用Update:功能更新商店,我如何才能做到这一

我使用GraphTool作为后端,但是有一个bug,短期内无法修复

文件
模式进行
删除
变异
将始终抛出此错误(不是什么大问题):

“GraphQL错误:哎呀。看起来像是内部服务器错误。请通过控制台()或电子邮件与我们联系。”(support@graph.cool)并包括您的请求ID:“

调用正常,但我需要在调用后访问
更新
功能,由于错误,我无法访问。

两种解决方案: 1.捕获graphql错误,以便我可以访问
更新:
函数,我如何才能做到这一点? 2.不使用
Update:
功能更新商店,我如何才能做到这一点

这是我的密码:

_deleteImageFile = async () => {
    // THIS WORKS, BUT GET AN ERROR
    const socialPostId = this.props.socialPost.id
    // Tried to wrap the following in try catch without success
    await this.props.deleteImageFileMutation({
        variables: {
            id: this.props.socialPost.image.id
        }, //Error hits here "internal service error..."
        update: (store) => { //This is never run because of error
            console.log('this text will never log')
            const userId = localStorage.getItem(GC_USER_ID)
            const data = store.readQuery({query: ALL_SOCIAL_POSTS_QUERY, 
                variables: {
                    id: userId
            }})
            // Need to change the store here
            store.writeQuery({query: ALL_SOCIAL_POSTS_QUERY, data, 
                variables: {
                    id: userId
            }}).catch(res => { const errors = res.graphQLErrors; console.log(errors)})
            //The catch was an attempt to fix it
        }
    })
}

参考错误:

您可以尝试传递另一个伪突变,并在抛出
deleteImageFileMutation
后进行传递

try {
  await this.props.deleteImageFileMutation ...
} catch (e) {
  // ...
} finally {
  await this.props.dummyMutation ...
}

哦,就像虚拟突变不会做任何事情,但它会给我机会更新你的意思是?