Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not load any more plugins with .after() when the previous errors #93

Open
mcollina opened this issue Feb 15, 2020 · 0 comments
Open

Comments

@mcollina
Copy link
Member

mcollina commented Feb 15, 2020

From Fastify https://github.com/fastify/fastify/pull/2093/files:

test('awaitable after error handling', async t => {
   const fastify = Fastify()
   let first = false
   let second = false
   let third = false

   // Note that this does not throw in case of error,
   // all errors are currently collected to ready() because it's
   // not really possible to do anything about them.
   await fastify.register(async (instance, opts, next) => {
     first = true
     throw new Error('kaboom')
   })
   t.is(first, true)

   fastify.register(async (instance, opts, next) => {
     second = true
   })

   await fastify.after()
   // TODO this is a bug, it should be false
   t.is(second, true)

   fastify.register(async (instance, opts, next) => {
     third = true
   })

   await t.rejects(fastify.ready())
   t.is(third, false)
 })

cc @davidmarkclements

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant