Skip to content

Commit

Permalink
Handle undefined cases
Browse files Browse the repository at this point in the history
  • Loading branch information
garyghayrat committed Jun 28, 2023
1 parent 5c9d0b6 commit d4c80eb
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions frontend/src/pages/AccountReceive.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@
<div class="row justify-start q-col-gutter-md">
<base-input
v-model.number="startBlockLocal"
@blur="setScanBlocks(startBlockLocal, endBlockLocal)"
@blur="setScanBlocks(startBlockLocal!, endBlockLocal!)"
class="col-xs-12 col-6"
:label="$t('Receive.start-block')"
:rules="isValidStartBlock"
/>
<base-input
v-model.number="endBlockLocal"
@blur="setScanBlocks(startBlockLocal, endBlockLocal)"
@blur="setScanBlocks(startBlockLocal!, endBlockLocal!)"
class="col-xs-12 col-6"
:label="$t('Receive.end-block')"
:rules="isValidEndBlock"
Expand Down Expand Up @@ -84,7 +84,7 @@
import { computed, defineComponent, onMounted, ref, watch } from 'vue';
import { QForm } from 'quasar';
import { UserAnnouncement, KeyPair, AnnouncementDetail, utils } from '@umbracash/umbra-js';
import { BigNumber, JsonRpcSigner, computeAddress, isHexString } from 'src/utils/ethers';
import { BigNumber, computeAddress, isHexString } from 'src/utils/ethers';
import useSettingsStore from 'src/store/settings';
import useWalletStore from 'src/store/wallet';
import useWallet from 'src/store/wallet';
Expand Down Expand Up @@ -180,11 +180,9 @@ function useScan() {
const overrides = { startBlock: startBlockLocal.value, endBlock: endBlockLocal.value };
let allAnnouncements: AnnouncementDetail[] = [];
try {
allAnnouncements = await umbra.value.fetchSomeAnnouncements(
signer.value as JsonRpcSigner,
userWalletAddress.value as string,
overrides
);
if (!signer.value) throw new Error('signer is undefined');
if (!userWalletAddress.value) throw new Error('userWalletAddress is undefined');
allAnnouncements = await umbra.value.fetchSomeAnnouncements(signer.value, userWalletAddress.value, overrides);
} catch (e) {
scanStatus.value = 'waiting'; // reset to the default state because we were unable to fetch announcements
throw e;
Expand Down

0 comments on commit d4c80eb

Please sign in to comment.