Skip to content

Commit caf5f7a

Browse files
committed
some type safety for caught errors
1 parent 2c0979c commit caf5f7a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/stargate/src/stargateclient.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,8 @@ export class StargateClient {
288288
try {
289289
const account = await this.forceGetQueryClient().auth.account(searchAddress);
290290
return account ? this.accountParser(account) : null;
291-
} catch (error: any) {
291+
} catch (error) {
292+
assert(error instanceof Error);
292293
if (/rpc error: code = NotFound/i.test(error.toString())) {
293294
return null;
294295
}
@@ -370,7 +371,8 @@ export class StargateClient {
370371
delegatedAmount = (
371372
await this.forceGetQueryClient().staking.delegation(delegatorAddress, validatorAddress)
372373
).delegationResponse?.balance;
373-
} catch (e: any) {
374+
} catch (e) {
375+
assert(e instanceof Error);
374376
if (e.toString().includes("key not found")) {
375377
// ignore, `delegatedAmount` remains undefined
376378
} else {

0 commit comments

Comments
 (0)