Skip to content

Commit 91baf27

Browse files
committed
sdk: await under try/catch to trigger exception
1 parent a205230 commit 91baf27

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

solana/ts/sdk/ntt.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -283,16 +283,15 @@ export class SolanaNtt<N extends Network, C extends SolanaChains>
283283
contracts: Contracts & { ntt: Ntt.Contracts },
284284
sender?: AccountAddress<SolanaChains>
285285
): Promise<IdlVersion> {
286-
// TODO: what? the try catch doesn't seem to work. it's not catching the error
287286
try {
288-
return NTT.getVersion(
287+
return await NTT.getVersion(
289288
connection,
290289
new PublicKey(contracts.ntt.manager!),
291290
sender ? new SolanaAddress(sender).unwrap() : undefined
292291
);
293292
} catch (e) {
293+
// This might happen if e.g. the program is not deployed yet.
294294
const version = "2.0.0"
295-
console.error(`Failed to get NTT version. Defaulting to ${version}`);
296295
return version;
297296
}
298297
}

0 commit comments

Comments
 (0)