From: Chris Duncan Date: Mon, 14 Oct 2024 21:38:32 +0000 (-0700) Subject: Add try-catch when storing wallet IDs. Update notification colors and messages. X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=1d0672586a45af86d92d931bd7cf48d86c3e810f;p=nemo-wallet.git Add try-catch when storing wallet IDs. Update notification colors and messages. --- 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') }