fastify/avvio

override function not throw errors

zhangwinning opened this issue ยท 2 comments

๐Ÿ› Bug Report

override callback function not throw errors

To Reproduce

Steps to reproduce the behavior:

invoke the below code, not throw errors

// Paste your code here
const boot = require('avvio');

const server = {my: 'server'};

const app = boot(server);

app.override = function (s, fn) {
    error;
    return s;
};

app.use(first);

function first(s, opts, cb) {
    cb();
}

Expected behavior

A clear and concise description of what you expected to happen.

should throw error

ReferenceError: error is not defined

Your Environment

  • node version: v12.14.0
  • fastify version: >=2.0.0
  • os: Mac
  • any other relevant information
Eomm commented

You need to manage the error:

app.use(first)
  .ready(e => {
    console.log(`The error is ${e.message}`)
  })

thanks, I got it