Open
Description
I was reviewing some codes using ava and found this pattern repeating often:
try {
await request(requestOptions);
} catch (error) {
t.true(error.statusCode === 500);
}
This can be written instead as:
const error = await t.throws(request(requestOptions));
t.true(error.statusCode === 500);
I think the latter should be preferred.
IssueHunt Summary
Backers (Total: $80.00)
issuehunt ($80.00)
Submitted pull Requests
Become a backer now!
Or submit a pull request to get the deposits!
Tips
- Checkout the Issuehunt explorer to discover more funded issues.
- Need some help from other developers? Add your repositories on IssueHunt to raise funds.