Added error handling for unknown block search

This commit is contained in:
sairaj mote 2023-07-05 13:47:47 +05:30
parent 9aa9facfeb
commit fcc4dd1ed8

View File

@ -472,10 +472,15 @@
router.addRoute('block', async state => { router.addRoute('block', async state => {
const [blockId] = state.wildcards const [blockId] = state.wildcards
if (!blockId) return; if (!blockId) return;
let [blockInfo, blockTxs] = await Promise.all([getBlockInfo(blockId), getBlockTransactions(blockId)]) try{
renderElem(getRef("page_container"), html`${render.blockPage(blockInfo)}`); let [blockInfo, blockTxs] = await Promise.all([getBlockInfo(blockId), getBlockTransactions(blockId)])
getRef("page_title").textContent = 'Block' renderElem(getRef("page_container"), html`${render.blockPage(blockInfo)}`);
renderTransactions('block_transaction_container', blockTxs) 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 => { router.addRoute('blocks', async state => {
let allBlocks = await getAllBlocks(100); let allBlocks = await getAllBlocks(100);