INNER CODE UNIT · TypeScript

getErrorInterface

graphql-compose/graphql-compose-mongoose · src/errors/index.ts:8

export function getErrorInterface(schemaComposer: SchemaComposer<any>): InterfaceTypeComposer {
  const ErrorInterface = schemaComposer.getOrCreateIFTC('ErrorInterface', (iftc) => {
    iftc.addFields({
      message: {
        description: 'Generic error message',
        type: 'String',
      },
    });

    const ValidationErrorOTC = getValidationErrorOTC(schemaComposer);
    const MongoErrorOTC = getMongoErrorOTC(schemaComposer);
    const RuntimeErrorOTC = getRuntimeErrorOTC(schemaComposer);

    ValidationErrorOTC.addInterface(iftc);
    MongoErrorOTC.addInterface(iftc);
    RuntimeErrorOTC.addInterface(iftc);

    schemaComposer.addSchemaMustHaveType(ValidationErrorOTC);

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…