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

Don't swallow errors from Engine #705

Merged
merged 2 commits into from
Nov 14, 2018
Merged

Conversation

trevor-scheer
Copy link
Member

Throw errors we receive from Engine so we can provide the right feedback to users and handle the errors.

Tested for client:check and client:push using invalid operations against a published schema.

Throw errors we receive from Engine so we can provide the right feedback
to users and handle the errors.
@trevor-scheer trevor-scheer merged commit 809c027 into master Nov 14, 2018
Copy link
Member

@abernix abernix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Post-merge review.

// throw new Error(errors);
// }
if (errors) {
throw new Error(errors.map(error => error.message).join("\n"));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we DRY this up a bit by creating a helper? This seems like it's going to be a very common pattern that's going to perpetuate if we don't nip it in the bud right now.

At the very least, this might be a mapGraphQLErrorsToString(errors) (and be errors.map(error => error.message).join("\n")), but I'd even go so far to say we could have a assertNoGraphQLErrors(errors); function which would be all three lines here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Totally not opposed, and had considered this.

@jbaxleyiii mentioned to me that we're going to overhaul error handling, I'll leave it up to him if this is something I should take care of or not if this goes away soon anyway.

@trevor-scheer trevor-scheer deleted the trevor/engine-errors branch November 21, 2018 23:03
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

Successfully merging this pull request may close these issues.

2 participants