Skip to content

Commit

Permalink
Don’t rely on near.account to throw
Browse files Browse the repository at this point in the history
Fixes account creation
  • Loading branch information
vgrichina committed Mar 3, 2021
1 parent 8c082ab commit 6179907
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion commands/create-account.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ async function createAccount(options) {
// Check to see if account already exists
try {
// This is expected to error because the account shouldn't exist
await near.account(options.accountId);
const account = await near.account(options.accountId);
await account.state();
throw new Error(`Sorry, account '${options.accountId}' already exists.`);
} catch (e) {
if (!e.message.includes('does not exist while viewing')) {
Expand Down

0 comments on commit 6179907

Please sign in to comment.