小编wmw*_*art的帖子

如何处理 React-admin 中的服务器错误?

我使用 GraphQL-Yoga 作为后端。
它返回的错误的格​​式与文档不匹配。但我需要他们的翻译。是否有一个地方React -admin可以捕获来自服务器的所有错误并按照 Notification 组件的预期进行处理?

Error:{
    extraInfo: undefined
    graphQLErrors: {
        locations: [{ column: 3, line: 2 }]
        message: "User with such login does not exist."
        path: ["login"]
    }
    message: "GraphQL error: User with such login does not exist."
    networkError: null
    stack: "Error: GraphQL error: User with such login does not exist.?    at new ApolloError (http://localhost:3000/static/js/1.chunk.js:39388:24)?    at Object.next (http://localhost:3000/static/js/1.chunk.js:38008:21)?    at notifySubscription (http://localhost:3000/static/js/1.chunk.js:270732:18)?    at onNotify (http://localhost:3000/static/js/1.chunk.js:270776:3)?    at SubscriptionObserver.next (http://localhost:3000/static/js/1.chunk.js:270828:7)?    at Object.next (http://localhost:3000/static/js/1.chunk.js:47919:22)?    at notifySubscription (http://localhost:3000/static/js/1.chunk.js:270732:18)?    at onNotify (http://localhost:3000/static/js/1.chunk.js:270776:3)? …
Run Code Online (Sandbox Code Playgroud)

reactjs react-admin

2
推荐指数
1
解决办法
5156
查看次数

标签 统计

react-admin ×1

reactjs ×1