From 978652bc0a143fa77b2133ec13b1557d1c3f651c Mon Sep 17 00:00:00 2001 From: Daniel Lugo Date: Mon, 13 Jul 2020 17:43:19 -0400 Subject: [PATCH] stricter type checking --- services/gunDB/contact-api/actions.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/services/gunDB/contact-api/actions.js b/services/gunDB/contact-api/actions.js index 25b98004..a0ae6171 100644 --- a/services/gunDB/contact-api/actions.js +++ b/services/gunDB/contact-api/actions.js @@ -1269,7 +1269,15 @@ const createPost = async (tags, title, content) => { v => typeof v !== 'number' ) - return typeof maybeNumOfPages === 'number' ? maybeNumOfPages : 0 + if (typeof maybeNumOfPages !== 'number') { + throw new TypeError( + `Could not fetch number of pages from wall, instead got: ${JSON.stringify( + maybeNumOfPages + )}` + ) + } + + return maybeNumOfPages })() let pageIdx = Math.max(0, numOfPages - 1).toString()