-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Only one way of dealing with ApolloError extensions (#5294)
In Apollo Server 2, we had two different ways to specify extensions to `ApolloError`: new ApolloError(message, code, {ext1: value}) new ApolloError(message, code, {extensions: {ext1: value}}) and two different ways to read those extensions back: error.extensions.ext1 error.ext1 This also meant that the extension values showed up twice in the user-exposed errors list. In Apollo Server 3, we have just one way to do it: the first line of each of those pairs. That is, we treat the third argument to the ApolloError constructor as "the extensions", not "the extensions or maybe something wrapping the extensions"; and we only put the extensions on `error.extensions`, not directly on `error` as well. (Note that the built in `code` and `exception` extensions already only lived on `extensions` rather than showing up twice!) If you try to use the old `{extensions: {...}}` method, the ApolloServer constructor throws instead of creating an extension named `extensions`. Fixes #3835.
- Loading branch information
Showing
4 changed files
with
81 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters