-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Account Id is now optional #50
base: expose-message-method
Are you sure you want to change the base?
Conversation
} else { | ||
const { region, accountId } = this.options.awsConfig; | ||
if (!accountId) | ||
this.getAwsAccountId(region).then((accountId) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use async/await and try/catch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a reason not using async await
here because we have to call its outer function in constructor? I don't know can constructor supports asynchronous calls
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets discuss this
A lot of functions rely on accountId and making this asynchronous would mean that those functions break if called before the accountId is set
if (!accountId) throw new Error('No Account Id Found.'); | ||
return accountId; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (!accountId) throw new Error('No Account Id Found.'); | |
return accountId; | |
if (!accountId) { | |
throw new Error('No Account Id Found.'); | |
return accountId}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How even this is possible to return Id after throwing error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (!accountId) throw new Error('No Account Id Found.'); | |
return accountId; | |
if (!accountId) { | |
throw new Error('No Account Id Found.'); | |
} | |
return accountId; |
is what I meant
5f9199b
to
cdb3655
Compare
No description provided.