Browse Source

Don't throw `Domain not found` when trying to `now alias` to a new domain (#702)

* Don't throw `Domain not found` when trying to alias to a new domain

* Remove `console.log`

* Prettier stuff
master
Matheus Fernandes 8 years ago
committed by GitHub
parent
commit
4dcab272df
  1. 12
      lib/alias.js

12
lib/alias.js

@ -670,7 +670,17 @@ module.exports = class Alias extends Now {
) )
const _domain = publicSuffixList.parse(alias).domain const _domain = publicSuffixList.parse(alias).domain
const _domainInfo = await this.getDomain(_domain) let _domainInfo
try {
_domainInfo = await this.getDomain(_domain)
} catch (err) {
if (err.status === 404) {
// It's ok if the domain was not found – we'll add it when creating
// the alias
} else {
throw err
}
}
const domainInfo = const domainInfo =
_domainInfo && !_domainInfo.error ? _domainInfo : undefined _domainInfo && !_domainInfo.error ? _domainInfo : undefined
const { domain, nameservers } = domainInfo const { domain, nameservers } = domainInfo

Loading…
Cancel
Save