Skip to content

Don't swallow errors from Engine#705

Merged
trevor-scheer merged 2 commits intomasterfrom
trevor/engine-errors
Nov 14, 2018
Merged

Don't swallow errors from Engine#705
trevor-scheer merged 2 commits intomasterfrom
trevor/engine-errors

Conversation

@trevor-scheer
Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor 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