From d918162a2f025f8edf44e724f37ed8a4c6e2ac37 Mon Sep 17 00:00:00 2001 From: Matchu Date: Sat, 3 Apr 2021 14:32:12 -0700 Subject: [PATCH] Minor bugfix in wakaValueText This is the same user-facing behavior, but stops logging errors for items that are _expected_ to not have Waka data --- src/server/types/Item.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/server/types/Item.js b/src/server/types/Item.js index 9147d93..a0cbddc 100644 --- a/src/server/types/Item.js +++ b/src/server/types/Item.js @@ -255,14 +255,16 @@ const resolvers = { return item.createdAt && item.createdAt.toISOString(); }, wakaValueText: async ({ id }, _, { itemWakaValueLoader }) => { + let wakaValue; try { - const wakaValue = await itemWakaValueLoader.load(id); - return wakaValue.value; + wakaValue = await itemWakaValueLoader.load(id); } catch (e) { console.error(`Error loading wakaValueText for item ${id}, skipping:`); console.error(e); - return null; + wakaValue = null; } + + return wakaValue ? wakaValue.value : null; }, currentUserOwnsThis: async (