Skip to content
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

Mutator should allow rethrowing errors in "onCreate", "onUpdate" callbacks for server generated fields #109

Open
eric-burel opened this issue Mar 29, 2022 · 0 comments
Labels
apollo enhancement New feature or request graphql

Comments

@eric-burel
Copy link
Collaborator

Is your feature request related to a problem? Please describe.

When a field callback fails, the error is always caught.
However, in some scenarios, you want such an error to bubble up and fail the whole document creation.

Describe the solution you'd like

https://github.com/VulcanJS/vulcan-npm/blob/main/packages/graphql/server/resolvers/mutators.ts#L318

Describe alternatives you've considered

  • optional in a field schema, means optional from the user standpoint, eg in forms or hooks.
  • However, sometimes, you want some data to be optional from the user standpoint, but you expect the creation process to succeed server-side via callbacks
  • We would need another option, like validateCallbacks that rethrows the error. OR we could reverse the current behaviour, throw as a default, and provide a dontFailOnCallbackError flag for instance.

Additional context
This was for example used in file upload in vulcan meteor.

@eric-burel eric-burel added enhancement New feature or request apollo graphql labels Mar 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
apollo enhancement New feature or request graphql
Projects
None yet
Development

No branches or pull requests

1 participant