graphql-js icon indicating copy to clipboard operation
graphql-js copied to clipboard

Can we align `GraphQLError` to utilize `Error.cause`?

Open Malien opened this issue 4 months ago • 1 comments

ECMAScript has standardized around new Error(message, { cause }) pattern. We have the originalError option. I'd hope we could alias and deprecate originalError in favor of cause to bring uniformity.

Maybe do a super(message, { cause }) call? Maybe do a Object.defineProperty?

And I also guess the cause is not necessarily is an Error, but is unknown per spec.

Malien avatar Sep 27 '25 09:09 Malien

This is an easy thing to do. I can draft a PR, but would mostly like to judge feedback if this is something we are willing to pursue

Malien avatar Sep 27 '25 10:09 Malien