As I understood addSchemaLevelResolver function add a root level resolver on schema and cut off the all other resolvers. And I tried that method like in the below.
if (process.env.DEV === true) {
schema = addSchemaLevelResolver(schema, () => {
throw new Error("Internal Server Error!");
});
}
Yes this function resolving and throw error when first call on some query or mutation on the schema. But after that it's not throwing the error as I expected and not blocking resolvers in the schema. Is this function only work for first call or is that a bug or am I doing it wrong?
addSchemaLevelResolver
has been removed in favor of Resolvers Composition.
I believe addSchemaLevelResolver
and the new Resolvers Composition
would literally traverse the schema and add resolve function to each Type and Field.