Mutation request that ends in Validation Error doesn't float error message to Promise's catch handler.
See original GitHub issueI have the following client code running in the browser:
client.hydrated().then(function handleClientHydrated(client) {
client.mutate({
mutation: createStuff,
variables: {
listOfStuff: listOfStuff,
},
}).then(function handleMutationSuccess(data) {
console.log(arguments);
if (!data.listOfStuff) {
throw new Error(`Server returned 200, but there was a validation error--and I can't see the error passed from the server via npm's require('aws-appsync').default module`);
}
}).catch(function handleMutationFailure() { // This never gets called.
console.error('failure',arguments);
});
});
In the network pane, it looks like AWS AppSync returns Status Code 200 and a nice object with juicy error information.
Should that error information be passed to the success callback? How about the error callback? Should the error callback get called?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Error handling with promises - The Modern JavaScript Tutorial
The code of a promise executor and promise handlers has an "invisible try..catch " around it. If an exception happens, it gets caught...
Read more >Full Stack Error Handling with GraphQL and Apollo
Request Errors occur when the client is at fault. There are 3 phases to a GraphQL query and client-caused errors may occur in...
Read more >Element: <oj-input-text> - Oracle
Note: JET validation is designed to catch user input errors, and not invalid data passed from the server; this should be caught on...
Read more >Validation and User Errors in GraphQL Mutations
In this blog post I would like to propose the pattern which you can use to handle user input validation and user errors...
Read more >Resolvers | NestJS - A progressive Node.js framework
The @nestjs/graphql package, on the other hand, generates a resolver map ... a query handler to get the author object based on the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I can use mutate function to successfully create new table, but can’t receive result back, something like
client.mutate({ mutation: mutations.createUser, variables: { … } }) .then(function logData(data) { console.log('results of mutation: ', data.data); }
just got
results of mutation: { createUser: null }
but the table creation is success
We have fixed this on the latest release (aws-appsync@1.4.0) I will close the issue for now, but feel free to create a new issue if this problem persist.