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

fix: amend error codes for latest avvio v8.3.0 #5309

Merged
merged 2 commits into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -464,5 +464,6 @@ module.exports.AVVIO_ERRORS_MAP = {
AVV_ERR_PLUGIN_NOT_VALID: codes.FST_ERR_PLUGIN_NOT_VALID,
AVV_ERR_ROOT_PLG_BOOTED: codes.FST_ERR_ROOT_PLG_BOOTED,
AVV_ERR_PARENT_PLG_LOADED: codes.FST_ERR_PARENT_PLUGIN_BOOTED,
AVV_ERR_READY_TIMEOUT: codes.FST_ERR_PLUGIN_TIMEOUT
AVV_ERR_READY_TIMEOUT: codes.FST_ERR_PLUGIN_TIMEOUT,
AVV_ERR_PLUGIN_EXEC_TIMEOUT: codes.FST_ERR_PLUGIN_TIMEOUT
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@
"@fastify/error": "^3.4.0",
"@fastify/fast-json-stringify-compiler": "^4.3.0",
"abstract-logging": "^2.0.1",
"avvio": "^8.2.1",
"avvio": "^8.3.0",
"fast-content-type-parse": "^1.1.0",
"fast-json-stringify": "^5.8.0",
"find-my-way": "^8.0.0",
Expand Down
2 changes: 1 addition & 1 deletion test/hooks.on-ready.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ t.test('onReady cannot add lifecycle hooks', t => {
t.ok(error)
t.equal(error.message, 'Root plugin has already booted')
// TODO: look where the error pops up
t.equal(error.code, 'AVV_ERR_PLUGIN_NOT_VALID')
t.equal(error.code, 'AVV_ERR_ROOT_PLG_BOOTED')
done(error)
}
})
Expand Down
6 changes: 3 additions & 3 deletions test/plugin.4.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ test('pluginTimeout', t => {
"fastify-plugin: Plugin did not start in time: 'function (app, opts, done) { -- // to no call done on purpose'. You may have forgotten to call 'done' function or to resolve a Promise")
t.equal(err.code, 'FST_ERR_PLUGIN_TIMEOUT')
t.ok(err.cause)
t.equal(err.cause.code, 'AVV_ERR_READY_TIMEOUT')
t.equal(err.cause.code, 'AVV_ERR_PLUGIN_EXEC_TIMEOUT')
})
})

Expand All @@ -40,7 +40,7 @@ test('pluginTimeout - named function', t => {
"fastify-plugin: Plugin did not start in time: 'nameFunction'. You may have forgotten to call 'done' function or to resolve a Promise")
t.equal(err.code, 'FST_ERR_PLUGIN_TIMEOUT')
t.ok(err.cause)
t.equal(err.cause.code, 'AVV_ERR_READY_TIMEOUT')
t.equal(err.cause.code, 'AVV_ERR_PLUGIN_EXEC_TIMEOUT')
})
})

Expand All @@ -60,7 +60,7 @@ test('pluginTimeout default', t => {
"fastify-plugin: Plugin did not start in time: 'function (app, opts, done) { -- // default time elapsed without calling done'. You may have forgotten to call 'done' function or to resolve a Promise")
t.equal(err.code, 'FST_ERR_PLUGIN_TIMEOUT')
t.ok(err.cause)
t.equal(err.cause.code, 'AVV_ERR_READY_TIMEOUT')
t.equal(err.cause.code, 'AVV_ERR_PLUGIN_EXEC_TIMEOUT')
})

t.teardown(clock.uninstall)
Expand Down
2 changes: 1 addition & 1 deletion test/pretty-print.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ test('pretty print - empty plugins', t => {
fastify.ready(() => {
const tree = fastify.printPlugins()
t.equal(typeof tree, 'string')
t.match(tree, 'bound root')
t.match(tree, /root \d+ ms\n└── bound _after \d+ ms/m)
})
})

Expand Down