From fcc4dd1ed8d186bbf79a8d564b8e4edf350c8e5a Mon Sep 17 00:00:00 2001 From: sairaj mote Date: Wed, 5 Jul 2023 13:47:47 +0530 Subject: [PATCH] Added error handling for unknown block search --- index.html | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index f260023..9170b98 100644 --- a/index.html +++ b/index.html @@ -472,10 +472,15 @@ router.addRoute('block', async state => { const [blockId] = state.wildcards if (!blockId) return; - let [blockInfo, blockTxs] = await Promise.all([getBlockInfo(blockId), getBlockTransactions(blockId)]) - renderElem(getRef("page_container"), html`${render.blockPage(blockInfo)}`); - getRef("page_title").textContent = 'Block' - renderTransactions('block_transaction_container', blockTxs) + try{ + let [blockInfo, blockTxs] = await Promise.all([getBlockInfo(blockId), getBlockTransactions(blockId)]) + renderElem(getRef("page_container"), html`${render.blockPage(blockInfo)}`); + getRef("page_title").textContent = 'Block' + renderTransactions('block_transaction_container', blockTxs) + }catch(e){ + console.error(e) + renderElem(getRef("page_container"), html`${render.errorPage(e)}`); + } }) router.addRoute('blocks', async state => { let allBlocks = await getAllBlocks(100);