From 29f3bff0d54a76079c9157ba518a69023c7406db Mon Sep 17 00:00:00 2001 From: Martin-dJ Date: Thu, 14 Mar 2019 17:02:26 +0000 Subject: [PATCH] Revised fix for issue #216 Reduce log noise (my previous attempt was incorrect). Switched to db.oneOrNone --- app/src/api/building.js | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/app/src/api/building.js b/app/src/api/building.js index 9890c3a6..87e7ac73 100644 --- a/app/src/api/building.js +++ b/app/src/api/building.js @@ -84,19 +84,14 @@ function getBuildingById(id) { } function getBuildingLikeById(building_id, user_id) { - return db.one( + return db.oneOrNone( "SELECT true as like FROM building_user_likes WHERE building_id = $1 and user_id = $2 LIMIT 1", [building_id, user_id] ).then(res => { return res && res.like }).catch(function (error) { - if (error instanceof pgp.errors.QueryResultError && error.message.includes("No data returned from the query")) { - // user hasn't liked building yet - return { error: 'It looks like you have not liked this building yet!' }; - } else { - return undefined - console.error(error); - } + console.error(error); + return undefined; }); }