Like this: https://github.com/graphql/graphql-js/blob/fed3ef58fde674fa96d79879eb4dfc24a0ba1db0/src/error/formatError.js#L30 I think this is very useful.