🐛 Bug Report
If an async hook returns a Promise.reject() the flow continue.
This usage of promise should be avoided at all, let me know if you think this is an invalid bug.
Here we should check the err param
|
function handleReject (err) { |
|
cb(err, request, reply) |
|
} |
To Reproduce
Steps to reproduce the behavior:
const fastify = require('./fastify')({ logger: true })
fastify.addHook('onRequest', function (request, reply) {
return Promise.reject()
})
fastify.get('/', async (request, reply) => { return 'hi' })
fastify.listen(3001)
Expected behavior
The rejection should be managed.
Originally posted by @Eomm in fastify/help#135 (comment)
🐛 Bug Report
If an async hook returns a
Promise.reject()the flow continue.This usage of promise should be avoided at all, let me know if you think this is an
invalidbug.Here we should check the
errparamfastify/lib/hooks.js
Lines 80 to 82 in 7fa4bdd
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The rejection should be managed.
Originally posted by @Eomm in fastify/help#135 (comment)