hard20 pts · first answer countsapi-designnodejserror-handling
A forgotten await crashes the server
After upgrading Node.js, the server sometimes exits when an audit-log call fails. The call is not awaited and has no .catch. Why?
function handler(req, res) {
auditLog.write(req.user, 'viewed') // returns a promise
res.json({ ok: true })
}Discussion 0
Join free to post in the discussion.
Related questions
- Promise and setTimeout orderBackend Developer
- Response for a successful DELETEBackend Developer
- A product page removed for goodBackend Developer
- Signing up with a taken usernameBackend Developer
- Calling DELETE on a read-only routeBackend Developer
- A client posts XML to a JSON APIBackend Developer
- URL for one productBackend Developer
- Telling the client where the new item livesBackend Developer