Summary
Several catch blocks discard the caught error without logging it or notifying
the user. When clipboard, wallet, or DID operations fail, nothing happens —
making real failures invisible and very hard to debug in production.
Affected code
Note: copyToClipboard in use-vault-setup.ts:57-66 calls
navigator.clipboard.writeText(text) without any try/catch or await, so a
rejected promise becomes an unhandled rejection. This should be fixed in the
same pass.
Why it's a problem
- Users get no feedback when "Copy" silently fails (e.g. non-secure context, or
browsers that block clipboard access).
- A failed wallet connection in
handleConnect looks identical to "nothing
happened", confusing users.
- Swallowed errors never reach logs or monitoring, so issues are invisible until
a user reports them.
Step-by-step fix
- Standardize on the existing toast utility. The project already uses
sonner (import { toast } from 'sonner'). Reuse it for user-facing feedback
so the UX stays consistent.
- Fix
copyId in vault/list/page.tsx:
- Import
toast from sonner.
- On success, call
toast.success('Copied to clipboard').
- In the
catch (e) block, call toast.error('Could not copy') and
console.warn('Clipboard copy failed', e).
- Fix
copyToClipboard in use-vault-setup.ts:
- Make the callback
async and await navigator.clipboard.writeText(text)
inside a try/catch.
- On failure, show
toast.error('Could not copy') and keep the copied*
state from flipping to true.
- Fix the
saveComputedDid effect in use-vault-setup.ts:
- In the
catch (e) block, add console.warn('Failed to compute DID', e).
- Optionally surface a non-blocking
toast.error('Could not initialize DID').
- Fix
handleConnect / handleDisconnect in Header.tsx:
- In each
catch (e), log with console.warn(...).
- For
handleConnect, show toast.error('Could not connect wallet') (replace
the "swallow to avoid extra alerts" comment — a single toast is the
intended single alert).
- Lint & build: run
npm run lint and npm run build to confirm no
unused-variable warnings remain from the renamed catch (e) parameters.
- Manual test:
- Trigger a copy in an insecure context (or stub
navigator.clipboard) and
confirm an error toast appears.
- Disconnect the wallet mid-connect and confirm the error is logged/toasted.
Acceptance criteria
- No empty
catch {} blocks remain in the affected files.
- Every failure path either logs (
console.warn/console.error) or shows a
toast (preferably both).
navigator.clipboard.writeText calls are awaited and wrapped in try/catch.
Summary
Several
catchblocks discard the caught error without logging it or notifyingthe user. When clipboard, wallet, or DID operations fail, nothing happens —
making real failures invisible and very hard to debug in production.
Affected code
copyIdswallows clipboard errors.saveComputedDid()errors are swallowed in auseEffect.handleConnect/handleDisconnectswallow wallet errors.Note:
copyToClipboardin use-vault-setup.ts:57-66 callsnavigator.clipboard.writeText(text)without anytry/catchorawait, so arejected promise becomes an unhandled rejection. This should be fixed in the
same pass.
Why it's a problem
browsers that block clipboard access).
handleConnectlooks identical to "nothinghappened", confusing users.
a user reports them.
Step-by-step fix
sonner(import { toast } from 'sonner'). Reuse it for user-facing feedbackso the UX stays consistent.
copyIdinvault/list/page.tsx:toastfromsonner.toast.success('Copied to clipboard').catch (e)block, calltoast.error('Could not copy')andconsole.warn('Clipboard copy failed', e).copyToClipboardinuse-vault-setup.ts:asyncandawait navigator.clipboard.writeText(text)inside a
try/catch.toast.error('Could not copy')and keep thecopied*state from flipping to
true.saveComputedDideffect inuse-vault-setup.ts:catch (e)block, addconsole.warn('Failed to compute DID', e).toast.error('Could not initialize DID').handleConnect/handleDisconnectinHeader.tsx:catch (e), log withconsole.warn(...).handleConnect, showtoast.error('Could not connect wallet')(replacethe "swallow to avoid extra alerts" comment — a single toast is the
intended single alert).
npm run lintandnpm run buildto confirm nounused-variable warnings remain from the renamed
catch (e)parameters.navigator.clipboard) andconfirm an error toast appears.
Acceptance criteria
catch {}blocks remain in the affected files.console.warn/console.error) or shows atoast (preferably both).
navigator.clipboard.writeTextcalls are awaited and wrapped intry/catch.