Skip to content

Instantly share code, notes, and snippets.

@rabeesh
Last active March 1, 2018 11:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rabeesh/23d62f301c6c8c976aaa6b540f755432 to your computer and use it in GitHub Desktop.
Save rabeesh/23d62f301c6c8c976aaa6b540f755432 to your computer and use it in GitHub Desktop.
Async/await in normal way
class Domain {
constructor(config, dal) {
this.dal = dal;
this.config = config;
this.domainName = null;
this.sslRedirect = false;
this.paymentRequired = false;
}
async load() {
try {
const domain = that.dal.getDomain();
this.domainName = domain.domain;
this.sslRedirect = domain.sslRedirect;
this.paymentRequired = domain.paymentRequired;
} catch(err) {
Failboat.tag(err, 'LoadDomain');
if (err.tags.join(' ') !== '404 DomainNotCreated LoadDomain') {
throw err;
}
if (this.config.SUBSCRIPTION_API_ENABLED) {
try {
return await this.dal.createService()
} catch(err) {
Failboat.tag(err, 'CreateService');
throw err;
}
}
try {
return await this.dal.createDomain();
} catch(err) {
Failboat.tag(err, 'CreateDomain');
throw err;
}
};
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment