-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Field resolution to error #36
Comments
For consistency with |
I added both route-level render and top-level renderError functions but in case of graphql error response, none of the methods are called with error argument. I see the following error in console:
I'am stuck for handling graphql errors from server:
would you please make an advise? |
I took a closer look. Per facebook/relay#1913, your network layer actually needs to throw if you get any errors from your back end. Separately, https://github.com/4Catalyzer/found-relay/pull/38/files#diff-0c098dedebf1347f99e1bf83329ad9d2R65 fixes a typo that would cause rendering to fail entirely when queries have errors. That is fixed in the newest alpha: https://github.com/4Catalyzer/found-relay/releases/tag/v0.3.0-alpha.3. |
thank you very much for your help. now, when both data and error are not null, route-level render error is populated with error but when only error exists and data is null in response, the following error is raised in console:
See the error |
You need to actually render something in |
Hi
If in schema.js, I resolve userType to a graphqlError by throwing an exception, nothing is rendered at all and renderError of routes is not called.
I get the following error in browser:
[HMR] Waiting for update signal from WDS... asyncToGenerator.js:20 Uncaught (in promise) undefined step @ asyncToGenerator.js:20 (anonymous) @ asyncToGenerator.js:30 Promise rejected (async) settle @ asyncGenerator.js:71 resume @ asyncGenerator.js:57 (anonymous) @ asyncGenerator.js:51 Promise rejected (async) settle @ asyncGenerator.js:71 resume @ asyncGenerator.js:57 (anonymous) @ asyncGenerator.js:51 Promise rejected (async) onError @ QuerySubscription.js:66 (anonymous) @ RelayNetwork.js:76 Promise resolved (async) executeImpl @ execute.js:133 execute @ execute.js:102 Object.defineProperty.value @ graphql.js:78 graphqlImpl @ graphql.js:62 graphql @ graphql.js:50 fetchQuery @ createFetch.js:14 requestStream @ RelayNetwork.js:59 streamQuery @ RelayModernEnvironment.js:115 (anonymous) @ QuerySubscription.js:35 F @ _export.js:35 fetch @ QuerySubscription.js:30 (anonymous) @ Resolver.js:41 _callee$ @ Resolver.js:40 tryCatch @ runtime.js:65 invoke @ runtime.js:303 prototype.(anonymous function) @ runtime.js:117 resume @ asyncGenerator.js:44 (anonymous) @ asyncGenerator.js:37 F @ _export.js:35 send @ asyncGenerator.js:24 exports.default.AsyncGenerator.next @ asyncGenerator.js:105 _callee$ @ resolveRenderArgs.js:3 tryCatch @ runtime.js:65 invoke @ runtime.js:303 prototype.(anonymous function) @ runtime.js:117 resume @ asyncGenerator.js:44 (anonymous) @ asyncGenerator.js:37 F @ _export.js:35 send @ asyncGenerator.js:24 exports.default.AsyncGenerator.next @ asyncGenerator.js:105 _callee$ @ createBaseRouter.js:11 tryCatch @ runtime.js:65 invoke @ runtime.js:303 prototype.(anonymous function) @ runtime.js:117 step @ asyncToGenerator.js:17 (anonymous) @ asyncToGenerator.js:35 F @ _export.js:35 (anonymous) @ asyncToGenerator.js:14 resolveMatch @ createBaseRouter.js:11 componentDidMount @ createBaseRouter.js:58 (anonymous) @ ReactCompositeComponent.js:264 measureLifeCyclePerf @ ReactCompositeComponent.js:75 (anonymous) @ ReactCompositeComponent.js:263 notifyAll @ CallbackQueue.js:76 close @ ReactReconcileTransaction.js:80 closeAll @ Transaction.js:209 perform @ Transaction.js:156 batchedMountComponentIntoNode @ ReactMount.js:126 perform @ Transaction.js:143 batchedUpdates @ ReactDefaultBatchingStrategy.js:62 batchedUpdates @ ReactUpdates.js:97 _renderNewRootComponent @ ReactMount.js:319 _renderSubtreeIntoContainer @ ReactMount.js:401 render @ ReactMount.js:422 (anonymous) @ client.js:45 __webpack_require__ @ bootstrap 8dbbe51…:659 fn @ bootstrap 8dbbe51…:85 (anonymous) @ amd-options.js:2 __webpack_require__ @ bootstrap 8dbbe51…:659 module.exports @ bootstrap 8dbbe51…:708 (anonymous) @ bootstrap 8dbbe51…:708 client?dc71:41 [WDS] Hot Module Replacement enabled.
which is caused by QuerySubscriber --> fetch--> onError() --> reject()
graphql response is as follows:
response json: { errors: [ { message: 'this is my error message', locations: [Object], path: [Object] } ], data: { viewer: { id: 'VXNlcjptZQ==', todos: null, numTodos: 2, numCompletedTodos: 1 } } } response json: { errors: [ { message: 'this is my error message', locations: [Object], path: [Object] } ], data: { viewer: { todos: null, id: 'VXNlcjptZQ==', numTodos: 2, numCompletedTodos: 1 } } }
The text was updated successfully, but these errors were encountered: