You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to find an issue for that, but I couldn't, so I'd like to open this one. I was wondering why there is no way to define exceptions in the schema for mutations. I know there are some workarounds for that, for instance adding the errors as part of the return value of the mutations, but I would rather prefer to throw an error and define it also in the schema.
If we take a look at a short example:
In this case, I want to provide a mutation to change a password, but it might be the case that the customer typed the wrong current password or the new password is not valid. I'd like to distinguish between those different validation errors to provide the proper error message in the user interface.
With that, I could easily generate a TypeScript client, that also provides type definitions for the errors. I wish I could do the same with a GraphQL schema.
What's your opinion about that?
The text was updated successfully, but these errors were encountered:
You're not alone in wanting different error definitions: #135 & #391 have both been reviewed and closed. I've also recently introduced #528 to at least require a client handle errors defined in mutations. Not sure if that could also help with generating Typescript clients, but I'd be interested in your thoughts.
Hey,
I tried to find an issue for that, but I couldn't, so I'd like to open this one. I was wondering why there is no way to define exceptions in the schema for mutations. I know there are some workarounds for that, for instance adding the errors as part of the return value of the mutations, but I would rather prefer to throw an error and define it also in the schema.
If we take a look at a short example:
In this case, I want to provide a mutation to change a password, but it might be the case that the customer typed the wrong current password or the new password is not valid. I'd like to distinguish between those different validation errors to provide the proper error message in the user interface.
Let's say I want to write down the same mutation in thrift, then I could do something like that:
With that, I could easily generate a TypeScript client, that also provides type definitions for the errors. I wish I could do the same with a GraphQL schema.
What's your opinion about that?
The text was updated successfully, but these errors were encountered: