apollo-server-core: add check for null property in ApolloError

This commit is contained in:
Evans Hauser 2018-05-03 09:59:12 -07:00
parent 0fe53a68da
commit c4e3766475
No known key found for this signature in database
GPG key ID: 88AF586817F52EEC

View file

@ -10,9 +10,12 @@ export class ApolloError extends Error {
) {
super(message);
Object.keys(properties).forEach(key => {
this[key] = properties[key];
});
if (properties) {
Object.keys(properties).forEach(key => {
this[key] = properties[key];
});
}
//extensions are flattened to be included in the root of GraphQLError's, so
//don't add properties to extensions
this.extensions = { code };