From 1fe50861457ac7f2c56f9bc72bc85934af713ab5 Mon Sep 17 00:00:00 2001 From: Eric Musyoka Date: Mon, 19 Aug 2024 14:22:46 +0300 Subject: [PATCH] Fix error when temp token not supplied and escape empty rows --- index.js | 2 +- routes/bounds.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 3bfd9c9..a0f019e 100644 --- a/index.js +++ b/index.js @@ -37,7 +37,7 @@ async function build() { } }) .catch((error) => { - req.log.error(err) + req.log.error(error) done(error.detail); }); } else if ("/health-check" == req.url) { diff --git a/routes/bounds.js b/routes/bounds.js index 7b21440..184d725 100644 --- a/routes/bounds.js +++ b/routes/bounds.js @@ -31,7 +31,7 @@ const schema = { querystring: { form_id: { type: 'string', - description: 'Form is', + description: 'Form id', }, limit: { type: 'string', @@ -62,7 +62,7 @@ module.exports = function (fastify, opts, next) { if (err) { reply.code(400).send(err) } else { - if(result.rows > 0) { + if(result.rows?.length > 0) { reply.send(result.rows[0]) } else { reply.code(404).send({error: 'No data found' });