From 1d0672586a45af86d92d931bd7cf48d86c3e810f Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Mon, 14 Oct 2024 14:38:32 -0700 Subject: [PATCH] Add try-catch when storing wallet IDs. Update notification colors and messages. --- app/pages/nemo-wallet.html | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/app/pages/nemo-wallet.html b/app/pages/nemo-wallet.html index 620f404..b8f1ab7 100644 --- a/app/pages/nemo-wallet.html +++ b/app/pages/nemo-wallet.html @@ -23,12 +23,20 @@ } async function createBip44Wallet () { const wallet = await Bip44Wallet.create('password') - addToStorage('Bip44Wallets', wallet.id) + try { + addToStorage('Bip44Wallets', wallet.id) + } catch (err) { + notify.error(err.msg) + } return wallet } async function createBlake2bWallet () { const wallet = await Blake2bWallet.create('password') - addToStorage('Blake2bWallets', wallet.id) + try { + addToStorage('Blake2bWallets', wallet.id) + } catch (err) { + notify.error(err.msg) + } return wallet } async function addToStorage (key, value) { @@ -61,7 +69,7 @@ async function clearStorage () { console.log('clear()') sessionStorage.clear() - notify.info('Session storage cleared') + notify.ok('Session storage cleared') } const notify = { show: (msg, color) => { @@ -75,9 +83,9 @@ notifications.appendChild(notification) }, info: (msg) => notify.show(msg), - ok: (msg) => notify.show(msg, 'green'), - warn: (msg) => notify.show(msg, 'yellow'), - error: (msg) => notify.show(msg, 'red') + ok: (msg) => notify.show(msg, 'DarkCyan'), + warn: (msg) => notify.show(`⚠️ ${msg}`, 'Goldenrod'), + error: (msg) => notify.show(`⚠️ ${msg}`, 'FireBrick') } -- 2.34.1