INNER CODE UNIT · TypeScript

childErrFn

thebigredgeek/apollo-resolvers · src/resolver.ts:61

    const childErrFn = (root, args, context, err) => {
      // Start with either the child error handler or a no-op (returns null)
      const entry = isFunction(cErrFn) ? Promisify(cErrFn)(root, args, context, err) : Promise.resolve(null);

      return entry.then(r => {
        // If the child returns a value, throw it
        if (isNotNullOrUndefined(r)) throw r;
        // Call the parent error handler or a no-op (returns null)
        return isFunction(errFn) ? Promisify(errFn)(root, args, context, err).then(e => {
          // If it resolves, throw the resolving value or the original error
          throw e || err;
        }, e => {
          // If it rejects, throw the rejecting value or the original error
          throw e || err;
        }) : Promise.resolve(null);
      });
    };

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…