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

Ensures formatError gets a value that passes instanceof Error #1235

Merged
merged 4 commits into from
Jun 25, 2018

Conversation

evans
Copy link
Contributor

@evans evans commented Jun 22, 2018

Fixes an issue brought up by @wKovacs64

@evans evans added this to the Release 2.0 milestone Jun 22, 2018
@@ -38,6 +38,7 @@ export class ApolloError extends Error implements GraphQLError {

function enrichError(error: Partial<GraphQLError>, debug: boolean = false) {
const expanded = {} as any;
Object.setPrototypeOf(expanded, Object.getPrototypeOf(error));
Copy link
Contributor

Choose a reason for hiding this comment

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

Or use Object.create(Object.getPrototypeOf(error), properties), with properties being the same object you pass to Object.defineProperties (so you don't need a separate call for that anymore).

@evans evans merged commit d85ef48 into version-2 Jun 25, 2018
@evans evans deleted the server-2.0/instanceof-errors branch June 25, 2018 23:36
@evans evans mentioned this pull request Jun 25, 2018
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants