Skip to content

Commit

Permalink
Refactored combined use of await and .then to use await only (#225)
Browse files Browse the repository at this point in the history
* Refactored combined use of await and .then to use await only.

* Removed an unnecessary semicolon
  • Loading branch information
taylanken authored and GantMan committed Oct 2, 2018
1 parent 12b8be2 commit 966d11f
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions src/extensions/functions/updateVersions.ts
Expand Up @@ -15,19 +15,18 @@ module.exports = async (context: SolidarityRunContext): Promise<void> => {
)

// run the array of promises you just created
await Promise.all(checks)
.then(results => {
const updates = flatten(results)
if (isEmpty(updates)) {
print.success('\n No Changes')
} else {
setSolidaritySettings(solidaritySettings, context)
const ruleMessage = pluralize('Rule', updates.length, true)
print.success(`\n ${ruleMessage} updated`)
}
})
.catch(err => {
print.error(err)
process.exit(2)
})
try {
const results = await Promise.all(checks)
const updates = flatten(results)
if (isEmpty(updates)) {
print.success('\n No Changes')
} else {
setSolidaritySettings(solidaritySettings, context)
const ruleMessage = pluralize('Rule', updates.length, true)
print.success(`\n ${ruleMessage} updated`)
}
} catch (err) {
print.error(err)
process.exit(2)
}
}

0 comments on commit 966d11f

Please sign in to comment.