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

Better default error handling #138

Open
Narretz opened this issue Feb 4, 2022 · 0 comments
Open

Better default error handling #138

Narretz opened this issue Feb 4, 2022 · 0 comments

Comments

@Narretz
Copy link

Narretz commented Feb 4, 2022

At the moment, createSmartQueryOptionsFunction and createMutation"swallow" errors when you don't define an onError function (which is usually done with the codegen plugin):

} catch (error) {
const { onError, context } = params;
const errorHandlerResult: ApolloErrorHandlerResultInterface | undefined =
onError != null ? onError(error, app, context) : undefined;

I find this behavior quite unintuitive. I would expect the to return the plain error returned from the reuqests (usually an ApolloError), same as the normal vue-apollo smart query / mutation do. Especially since the errorHandleResultInterface seems very opinionated and doesn't match the standard vue-apollo behavior:

} catch (error) {
const { onError, context } = params;
const errorHandlerResult: ApolloErrorHandlerResultInterface | undefined =
onError != null ? onError(error, app, context) : undefined;

If you want to use this library mostly for the benefit of having types for operation arguments, and results, it's not necessary to conform to a different error result.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant