Skip to content

Commit 966d11f

Browse files
taylankenGantMan
authored andcommitted
Refactored combined use of await and .then to use await only (#225)
* Refactored combined use of await and .then to use await only. * Removed an unnecessary semicolon
1 parent 12b8be2 commit 966d11f

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

src/extensions/functions/updateVersions.ts

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,18 @@ module.exports = async (context: SolidarityRunContext): Promise<void> => {
1515
)
1616

1717
// run the array of promises you just created
18-
await Promise.all(checks)
19-
.then(results => {
20-
const updates = flatten(results)
21-
if (isEmpty(updates)) {
22-
print.success('\n No Changes')
23-
} else {
24-
setSolidaritySettings(solidaritySettings, context)
25-
const ruleMessage = pluralize('Rule', updates.length, true)
26-
print.success(`\n ${ruleMessage} updated`)
27-
}
28-
})
29-
.catch(err => {
30-
print.error(err)
31-
process.exit(2)
32-
})
18+
try {
19+
const results = await Promise.all(checks)
20+
const updates = flatten(results)
21+
if (isEmpty(updates)) {
22+
print.success('\n No Changes')
23+
} else {
24+
setSolidaritySettings(solidaritySettings, context)
25+
const ruleMessage = pluralize('Rule', updates.length, true)
26+
print.success(`\n ${ruleMessage} updated`)
27+
}
28+
} catch (err) {
29+
print.error(err)
30+
process.exit(2)
31+
}
3332
}

0 commit comments

Comments
 (0)