Skip to content

Commit

Permalink
Try catches
Browse files Browse the repository at this point in the history
  • Loading branch information
schnetzlerjoe committed Sep 12, 2023
1 parent 18da49c commit 9329646
Showing 1 changed file with 24 additions and 9 deletions.
33 changes: 24 additions & 9 deletions packages/ui/src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,38 @@
let loading = false;
$: if (isMetaMaskInstalledValue && isSnapInitValue && isSnapInstalledValue) {
$state.connected = true;
goto("/balances");
}
const initializeData = async () => {
loading = true;
isMetaMaskInstalledValue = isMetaMaskInstalled() ?? false;
isSnapInstalledValue = await isSnapInstalled() ?? false;
loading = false;
try {
loading = true;
isMetaMaskInstalledValue = isMetaMaskInstalled() ?? false;
isSnapInstalledValue = await isSnapInstalled() ?? false;
loading = false;
} catch (err: any) {
loading = false;
$state.alertText = `${err.message}`
$state.alertType = "danger"
$state.showAlert = true
}
};
const runInstallSnap = async () => {
loading = true;
await installSnap();
isSnapInstalledValue = true;
isSnapInitValue = false;
loading = false;
try {
loading = true;
await installSnap();
isSnapInstalledValue = true;
isSnapInitValue = false;
loading = false;
} catch (err: any) {
loading = false;
$state.alertText = `${err.message}`
$state.alertType = "danger"
$state.showAlert = true
}
};
const initializeSnap = async () => {
Expand Down

0 comments on commit 9329646

Please sign in to comment.