Accept non-string type in getAccount error

This commit is contained in:
Simon Warta 2021-11-24 13:56:36 +01:00
parent b859384035
commit 652d377f1d
2 changed files with 4 additions and 4 deletions

View File

@ -154,8 +154,8 @@ export class CosmWasmClient {
try {
const account = await this.forceGetQueryClient().auth.account(searchAddress);
return account ? accountFromAny(account) : null;
} catch (error) {
if (typeof error === "string" && /rpc error: code = NotFound/i.test(error)) {
} catch (error: any) {
if (/rpc error: code = NotFound/i.test(error.toString())) {
return null;
}
throw error;

View File

@ -214,8 +214,8 @@ export class StargateClient {
try {
const account = await this.forceGetQueryClient().auth.account(searchAddress);
return account ? accountFromAny(account) : null;
} catch (error) {
if (typeof error === "string" && /rpc error: code = NotFound/i.test(error)) {
} catch (error: any) {
if (/rpc error: code = NotFound/i.test(error.toString())) {
return null;
}
throw error;