From 5bf1d430d17bf29bc8f1a8ba6d247af42afa0e5d Mon Sep 17 00:00:00 2001 From: Angelo Ashmore Date: Fri, 7 Feb 2020 18:24:49 -1000 Subject: [PATCH] fix: await resolver function --- src/generator.ts | 2 +- tests/fallback.test.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/generator.ts b/src/generator.ts index f052156d3..3b50ae4da 100644 --- a/src/generator.ts +++ b/src/generator.ts @@ -67,7 +67,7 @@ function generateFieldMiddlewareFromRule( const res = await rule.resolve(parent, args, ctx, info, options) if (res === true) { - return resolve(parent, args, ctx, info) + return await resolve(parent, args, ctx, info) } else if (res === false) { return options.fallbackError } else { diff --git a/tests/fallback.test.ts b/tests/fallback.test.ts index 2bda24c56..b0d0f336b 100644 --- a/tests/fallback.test.ts +++ b/tests/fallback.test.ts @@ -14,7 +14,7 @@ describe('fallbackError correctly handles errors', () => { ` const resolvers = { Query: { - test: () => { + test: async () => { throw new Error() }, },