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
improve setErrorHandler
example
#4484
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
@Fdawgs your suggestions doesn't show |
Yeah something was up when doing it on mobile. |
I find your suggestions in notification email |
@Fdawgs you suggest to replace If user error handler |
|
No, maybe they should, but they don't. Try this: main.mjs import Fastify from 'fastify';
import * as http from 'http';
const fastify = Fastify();
fastify.get('/', async (request, reply) => {
throw new Error("tt");
});
fastify.setErrorHandler(function(error, request, reply) {
throw error;
});
console.log(await fastify.listen({ port: 4000, host: '127.0.0.1' }));
http.request('http://127.0.0.1:4000'); (latest fastify version, 4.10.2) But it works with |
Interesting, but given as the example itself. It does work. import Fastify from 'fastify';
const fastify = Fastify({ logger: false })
fastify.get('/', function(request, reply) {
reply.code('bad status code').send({ hello: 'world' })
});
fastify.get('/bad-case', function(request, reply) {
throw new Error("bad-case");
});
fastify.setErrorHandler(function(error, request, reply) {
if (error instanceof Fastify.errorCodes.FST_ERR_BAD_STATUS_CODE) {
// Send error response
reply.status(500).send({ ok: false });
} else {
throw error
}
});
{
const { statusCode, payload } = await fastify.inject('/')
console.log(statusCode, payload)
}
{
const { statusCode, payload } = await fastify.inject('/bad-case')
console.log(statusCode, payload)
} |
@climba03003 you need to use async handler |
- fastify.get('/bad-case', function(request, reply) {
+ fastify.get('/bad-case', async function(request, reply) {
throw new Error("bad-case");
}); |
this will trigger node:internal/process/promises:288 triggerUncaughtException(err, true /* fromPromise */);
|
This may be a bug? |
I would say yes, it just fall into some edge case that can actually crash the problem. Let see what the others say. @fastify/core |
them I think it should be |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
About this bug, you can throw error from both sync/async handler in async error Handler, this is expected behavior This works find in all case fastify.setErrorHandler(async function(error, request, reply) {
if (error instanceof Fastify.errorCodes.FST_ERR_BAD_STATUS_CODE) {
// Send error response
return reply.status(500).send({ ok: false });
}
throw error;
}); But you can't throw error from async handler in sync error handler BUG: fastify.get('/bad-case', async function(request, reply) {
throw new Error("bad-case");
});
fastify.setErrorHandler(function(error, request, reply) {
if (error instanceof Fastify.errorCodes.FST_ERR_BAD_STATUS_CODE) {
// Send error response
return reply.status(500).send({ ok: false });
}
throw error;
}); |
[](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [@types/jest](https://togithub.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/jest) ([source](https://togithub.com/DefinitelyTyped/DefinitelyTyped)) | [`29.2.4` -> `29.2.5`](https://renovatebot.com/diffs/npm/@types%2fjest/29.2.4/29.2.5) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | | [@typescript-eslint/eslint-plugin](https://togithub.com/typescript-eslint/typescript-eslint) | [`5.47.1` -> `5.48.0`](https://renovatebot.com/diffs/npm/@typescript-eslint%2feslint-plugin/5.47.1/5.48.0) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | | [@typescript-eslint/parser](https://togithub.com/typescript-eslint/typescript-eslint) | [`5.47.1` -> `5.48.0`](https://renovatebot.com/diffs/npm/@typescript-eslint%2fparser/5.47.1/5.48.0) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | | [antd](https://ant.design) ([source](https://togithub.com/ant-design/ant-design)) | [`5.1.1` -> `5.1.2`](https://renovatebot.com/diffs/npm/antd/5.1.1/5.1.2) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | | [eslint](https://eslint.org) ([source](https://togithub.com/eslint/eslint)) | [`8.30.0` -> `8.31.0`](https://renovatebot.com/diffs/npm/eslint/8.30.0/8.31.0) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | | [fastify](https://www.fastify.io/) ([source](https://togithub.com/fastify/fastify)) | [`4.10.2` -> `4.11.0`](https://renovatebot.com/diffs/npm/fastify/4.10.2/4.11.0) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | | [husky](https://typicode.github.io/husky) ([source](https://togithub.com/typicode/husky)) | [`8.0.2` -> `8.0.3`](https://renovatebot.com/diffs/npm/husky/8.0.2/8.0.3) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | | [jest-extended](https://togithub.com/jest-community/jest-extended) | [`3.2.0` -> `3.2.1`](https://renovatebot.com/diffs/npm/jest-extended/3.2.0/3.2.1) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | | [liquidjs](https://togithub.com/harttle/liquidjs) | [`10.3.3` -> `10.4.0`](https://renovatebot.com/diffs/npm/liquidjs/10.3.3/10.4.0) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | | [tsconfig-paths](https://togithub.com/dividab/tsconfig-paths) | [`4.1.1` -> `4.1.2`](https://renovatebot.com/diffs/npm/tsconfig-paths/4.1.1/4.1.2) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>typescript-eslint/typescript-eslint (@​typescript-eslint/eslint-plugin)</summary> ### [`v5.48.0`](https://togithub.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/eslint-plugin/CHANGELOG.md#​5480-httpsgithubcomtypescript-eslinttypescript-eslintcomparev5471v5480-2023-01-02) [Compare Source](https://togithub.com/typescript-eslint/typescript-eslint/compare/v5.47.1...v5.48.0) ##### Features - **eslint-plugin:** specify which method is unbound and added test case ([#​6281](https://togithub.com/typescript-eslint/typescript-eslint/issues/6281)) ([cf3ffdd](https://togithub.com/typescript-eslint/typescript-eslint/commit/cf3ffdd49aceb734ce18dc44ed6a11f7701f178e)) #### [5.47.1](https://togithub.com/typescript-eslint/typescript-eslint/compare/v5.47.0...v5.47.1) (2022-12-26) ##### Bug Fixes - **ast-spec:** correct some incorrect ast types ([#​6257](https://togithub.com/typescript-eslint/typescript-eslint/issues/6257)) ([0f3f645](https://togithub.com/typescript-eslint/typescript-eslint/commit/0f3f64571ea5d938081b1a9f3fd1495765201700)) - **eslint-plugin:** \[member-ordering] correctly invert optionalityOrder ([#​6256](https://togithub.com/typescript-eslint/typescript-eslint/issues/6256)) ([ccd45d4](https://togithub.com/typescript-eslint/typescript-eslint/commit/ccd45d4a998946b7be1161f8c8216bc458e50b4e)) </details> <details> <summary>typescript-eslint/typescript-eslint (@​typescript-eslint/parser)</summary> ### [`v5.48.0`](https://togithub.com/typescript-eslint/typescript-eslint/blob/HEAD/packages/parser/CHANGELOG.md#​5480-httpsgithubcomtypescript-eslinttypescript-eslintcomparev5471v5480-2023-01-02) [Compare Source](https://togithub.com/typescript-eslint/typescript-eslint/compare/v5.47.1...v5.48.0) **Note:** Version bump only for package [@​typescript-eslint/parser](https://togithub.com/typescript-eslint/parser) #### [5.47.1](https://togithub.com/typescript-eslint/typescript-eslint/compare/v5.47.0...v5.47.1) (2022-12-26) **Note:** Version bump only for package [@​typescript-eslint/parser](https://togithub.com/typescript-eslint/parser) </details> <details> <summary>ant-design/ant-design</summary> ### [`v5.1.2`](https://togithub.com/ant-design/ant-design/releases/tag/5.1.2) [Compare Source](https://togithub.com/ant-design/ant-design/compare/5.1.1...5.1.2) - 🆕 Theme Editor supports uploading themes. [#​39621](https://togithub.com/ant-design/ant-design/pull/39621) [@​BoyYangzai](https://togithub.com/BoyYangzai) - 💄 Refactor wave effect that can now trigger multiple times. [#​39705](https://togithub.com/ant-design/ant-design/pull/39705) [@​li-jia-nan](https://togithub.com/li-jia-nan) - Table - 🐞 Fix Table `column.filtered` cannot be updated. [#​39883](https://togithub.com/ant-design/ant-design/pull/39883) - 🐞 Fix Table fixed column which is sorted or filtered transparent background bug. [#​39012](https://togithub.com/ant-design/ant-design/pull/39012) [@​kiner-tang](https://togithub.com/kiner-tang) - 🐞 Fix Image preview style conflict with TailwindCSS. [#​39914](https://togithub.com/ant-design/ant-design/pull/39914) - 🐞 Fix Dropdown `danger` and `disabled` style priority bug. [#​39904](https://togithub.com/ant-design/ant-design/pull/39904) [@​Wxh16144](https://togithub.com/Wxh16144) - 🐞 Fix App.useApp `modal` default `okText`. [#​39884](https://togithub.com/ant-design/ant-design/pull/39884) [@​BoyYangzai](https://togithub.com/BoyYangzai) - 💄 Fix Input.Group misplace style when zoom up in windows. [#​39842](https://togithub.com/ant-design/ant-design/pull/39842) [@​heiyu4585](https://togithub.com/heiyu4585) - 🐞 Fix Slider missing Tooltip appear motion. [#​39857](https://togithub.com/ant-design/ant-design/pull/39857) - 🐞 Fix QRCode missing expired style. [#​39849](https://togithub.com/ant-design/ant-design/pull/39849) [@​li-jia-nan](https://togithub.com/li-jia-nan) - 🐞 Fix Tree switcher's background display unexpected in dark theme. [#​39838](https://togithub.com/ant-design/ant-design/pull/39838) [@​kiner-tang](https://togithub.com/kiner-tang) - 🐞 Fix Menu slide bar style issue when `border` is reset by preset. [#​39819](https://togithub.com/ant-design/ant-design/pull/39819) [@​MadCcc](https://togithub.com/MadCcc) - 🐞 Fix Checkbox not support Tooltip or Popover when it is `disabled`. [#​39829](https://togithub.com/ant-design/ant-design/pull/39829) *** - 🆕 官网主题编辑器添加主题上传功能。[#​39621](https://togithub.com/ant-design/ant-design/pull/39621) [@​BoyYangzai](https://togithub.com/BoyYangzai) - 💄 重构水波纹视效,现在可以多个水波纹同时触发了。[#​39705](https://togithub.com/ant-design/ant-design/pull/39705) [@​li-jia-nan](https://togithub.com/li-jia-nan) - Table - 🐞 修复 Table `column.filtered` 更新不生效的问题。[#​39883](https://togithub.com/ant-design/ant-design/pull/39883) - 🐞 修复 Table 排序/筛选的固定列背景色透明的样式异常问题。[#​39012](https://togithub.com/ant-design/ant-design/pull/39012) [@​kiner-tang](https://togithub.com/kiner-tang) - 🐞 解决 Image 预览样式会被 TailwindCSS 影响的问题。[#​39914](https://togithub.com/ant-design/ant-design/pull/39914) - 🐞 修复 Dropdown 组件 `danger` 和 `disabled` 属性同时使用的样式问题。[#​39904](https://togithub.com/ant-design/ant-design/pull/39904) [@​Wxh16144](https://togithub.com/Wxh16144) - 🐞 修复 App `useApp` 中 `modal` 确认按钮文案。[#​39884](https://togithub.com/ant-design/ant-design/pull/39884) [@​BoyYangzai](https://togithub.com/BoyYangzai) - 🐞 修复 Input.Group 在 windows 下缩放屏幕时的错位问题。[#​39842](https://togithub.com/ant-design/ant-design/pull/39842) [@​heiyu4585](https://togithub.com/heiyu4585) - 🐞 修复 Slider 展示 Tooltip 时动画丢失的问题。[#​39857](https://togithub.com/ant-design/ant-design/pull/39857) - 🐞 修复 QRCode 过期文案在暗色模式下看不清的问题。[#​39849](https://togithub.com/ant-design/ant-design/pull/39849) [@​li-jia-nan](https://togithub.com/li-jia-nan) - 🐞 修复 Tree 在暗黑模式下 `switcher` 背景显示异常问题。[#​39838](https://togithub.com/ant-design/ant-design/pull/39838) [@​kiner-tang](https://togithub.com/kiner-tang) - 🐞 修复 Menu 组件滑块在 `border` 被预设值重置时的样式问题。[#​39819](https://togithub.com/ant-design/ant-design/pull/39819) - 🐞 修复 Checkbox 禁用时不支持 Tooltip 和 Popover 的问题。[#​39829](https://togithub.com/ant-design/ant-design/pull/39829) </details> <details> <summary>eslint/eslint</summary> ### [`v8.31.0`](https://togithub.com/eslint/eslint/releases/tag/v8.31.0) [Compare Source](https://togithub.com/eslint/eslint/compare/v8.30.0...v8.31.0) #### Features - [`52c7c73`](https://togithub.com/eslint/eslint/commit/52c7c73c052e1ec2528c6b4af78181bc30cf8cdd) feat: check assignment patterns in no-underscore-dangle ([#​16693](https://togithub.com/eslint/eslint/issues/16693)) (Milos Djermanovic) - [`b401cde`](https://togithub.com/eslint/eslint/commit/b401cde47d44746ff91b8feced3fb3a4e32c0e12) feat: add options to check destructuring in no-underscore-dangle ([#​16006](https://togithub.com/eslint/eslint/issues/16006)) (Morten Kaltoft) - [`30d0daf`](https://togithub.com/eslint/eslint/commit/30d0daf55e85a412995f6d69f47cab3fb591f2c3) feat: group properties with values in parentheses in `key-spacing` ([#​16677](https://togithub.com/eslint/eslint/issues/16677)) (Francesco Trotta) #### Bug Fixes - [`35439f1`](https://togithub.com/eslint/eslint/commit/35439f1572e1a8888f7feb6c5e51a15b5582495d) fix: correct syntax error in `prefer-arrow-callback` autofix ([#​16722](https://togithub.com/eslint/eslint/issues/16722)) (Francesco Trotta) - [`87b2470`](https://togithub.com/eslint/eslint/commit/87b247058ed520061fe1a146b7f0e7072a94990d) fix: new instance of FlatESLint should load latest config file version ([#​16608](https://togithub.com/eslint/eslint/issues/16608)) (Milos Djermanovic) #### Documentation - [`4339dc4`](https://togithub.com/eslint/eslint/commit/4339dc462d78888fe2e10acdfacd6f57245ce6ae) docs: Update README (GitHub Actions Bot) - [`4e4049c`](https://togithub.com/eslint/eslint/commit/4e4049c5fa355b2091afc8948690fcd7b1c1e6df) docs: optimize code block structure ([#​16669](https://togithub.com/eslint/eslint/issues/16669)) (Sam Chen) - [`54a7ade`](https://togithub.com/eslint/eslint/commit/54a7ade5d8e6f59554afeb9202ba6143f8afdf57) docs: do not escape code blocks of formatters examples ([#​16719](https://togithub.com/eslint/eslint/issues/16719)) (Sam Chen) - [`e5ecfef`](https://togithub.com/eslint/eslint/commit/e5ecfefa1c952195a3a8371f5953cc655d844079) docs: Add function call example for no-undefined ([#​16712](https://togithub.com/eslint/eslint/issues/16712)) (Elliot Huffman) - [`a3262f0`](https://togithub.com/eslint/eslint/commit/a3262f0a6305d2a721fac137a60c62c019b26aa4) docs: Add mastodon link ([#​16638](https://togithub.com/eslint/eslint/issues/16638)) (Amaresh S M) - [`a14ccf9`](https://togithub.com/eslint/eslint/commit/a14ccf91af1122e419710f58ef494980fc4894b3) docs: clarify files property ([#​16709](https://togithub.com/eslint/eslint/issues/16709)) (Sam Chen) - [`3b29eb1`](https://togithub.com/eslint/eslint/commit/3b29eb14e00182614c986d8498b483a9917976e7) docs: fix npm link ([#​16710](https://togithub.com/eslint/eslint/issues/16710)) (Abdullah Osama) - [`a638673`](https://togithub.com/eslint/eslint/commit/a638673ee6e94344c46d12dfc988adeb3783f817) docs: fix search bar focus on `Esc` ([#​16700](https://togithub.com/eslint/eslint/issues/16700)) (Shanmughapriyan S) - [`f62b722`](https://togithub.com/eslint/eslint/commit/f62b722251858a5dfb157591910edbaaeb4a966f) docs: country flag missing in windows ([#​16698](https://togithub.com/eslint/eslint/issues/16698)) (Shanmughapriyan S) - [`4d27ec6`](https://togithub.com/eslint/eslint/commit/4d27ec6019847afabeebf592dddc014e9220057c) docs: display zh-hans in the docs language switcher ([#​16686](https://togithub.com/eslint/eslint/issues/16686)) (Percy Ma) - [`8bda20e`](https://togithub.com/eslint/eslint/commit/8bda20e8276c6ba17d31842fcdd63ba65476fbbd) docs: remove manually maintained anchors ([#​16685](https://togithub.com/eslint/eslint/issues/16685)) (Percy Ma) - [`b68440f`](https://togithub.com/eslint/eslint/commit/b68440ff2b8322fc00373792701169205c94ed94) docs: User Guide Getting Started expansion ([#​16596](https://togithub.com/eslint/eslint/issues/16596)) (Ben Perlmutter) #### Chores - [`65d4e24`](https://togithub.com/eslint/eslint/commit/65d4e24c36367cd63f0eba7371820e0e81dae7aa) chore: Upgrade [@​eslint/eslintrc](https://togithub.com/eslint/eslintrc)[@​1](https://togithub.com/1).4.1 ([#​16729](https://togithub.com/eslint/eslint/issues/16729)) (Brandon Mills) - [`8d93081`](https://togithub.com/eslint/eslint/commit/8d93081a717f6e8b8cb60c3075cc1d7e4e655e6b) chore: fix CI failure ([#​16721](https://togithub.com/eslint/eslint/issues/16721)) (Sam Chen) - [`8f17247`](https://togithub.com/eslint/eslint/commit/8f17247a93240ff8a08980d8e06352e4ff4e8fe3) chore: Set up automatic updating of README ([#​16717](https://togithub.com/eslint/eslint/issues/16717)) (Nicholas C. Zakas) - [`4cd87cb`](https://togithub.com/eslint/eslint/commit/4cd87cb3c52412277577ba00c4fbb1aec36acc8c) ci: bump actions/stale from 6 to 7 ([#​16713](https://togithub.com/eslint/eslint/issues/16713)) (dependabot\[bot]) - [`fd20c75`](https://togithub.com/eslint/eslint/commit/fd20c75b1059c54d598c0abaf63e7d7a80f04f32) chore: sort package.json scripts in alphabetical order ([#​16705](https://togithub.com/eslint/eslint/issues/16705)) (Darius Dzien) - [`10a5c78`](https://togithub.com/eslint/eslint/commit/10a5c7839370219c79f44d4206cbd7c28a72bad5) chore: update ignore patterns in `eslint.config.js` ([#​16678](https://togithub.com/eslint/eslint/issues/16678)) (Milos Djermanovic) </details> <details> <summary>fastify/fastify</summary> ### [`v4.11.0`](https://togithub.com/fastify/fastify/releases/tag/v4.11.0) [Compare Source](https://togithub.com/fastify/fastify/compare/v4.10.2...v4.11.0) ##### What's Changed - fix: use generic for Logger to register plugins when using a custom logger ([#​4435](https://togithub.com/fastify/fastify/issues/4435)) by [@​marcoreni](https://togithub.com/marcoreni) in [fastify/fastify#4436 - Incorrect example in default text parser docs by [@​SaumyaBhushan](https://togithub.com/SaumyaBhushan) in [fastify/fastify#4448 - chore: fix test skips for nodejs prereleases by [@​nlf](https://togithub.com/nlf) in [fastify/fastify#4449 - Move [@​Ethan-Arrowood](https://togithub.com/Ethan-Arrowood) to Past Collaborator section by [@​Ethan-Arrowood](https://togithub.com/Ethan-Arrowood) in [fastify/fastify#4451 - build(deps): bump lycheeverse/lychee-action from 1.5.1 to 1.5.4 by [@​dependabot](https://togithub.com/dependabot) in [fastify/fastify#4454 - build(deps): bump actions/dependency-review-action from 2 to 3 by [@​dependabot](https://togithub.com/dependabot) in [fastify/fastify#4455 - build(deps-dev): bump tsd from 0.24.1 to 0.25.0 by [@​dependabot](https://togithub.com/dependabot) in [fastify/fastify#4460 - docs: add fastify-user-agent by [@​Eomm](https://togithub.com/Eomm) in [fastify/fastify#4466 - chore(ecosystem): rename fastify-lyra plugin by [@​mateonunez](https://togithub.com/mateonunez) in [fastify/fastify#4474 - docs(ecosystem): add fastify-at-mysql plugin by [@​mateonunez](https://togithub.com/mateonunez) in [fastify/fastify#4473 - fix: make res.statusCode optional by [@​polRk](https://togithub.com/polRk) in [fastify/fastify#4471 - docs(ecosystem): add fastify-at-postgres plugin by [@​mateonunez](https://togithub.com/mateonunez) in [fastify/fastify#4475 - perf: precompute isEssence for RegExp of content-type-parser method compareRegExpContentType by [@​Uzlopak](https://togithub.com/Uzlopak) in [fastify/fastify#4481 - lib: deprecate the default route and improve its documentation by [@​RafaelGSS](https://togithub.com/RafaelGSS) in [fastify/fastify#4480 - docs(reference/reply): When using async-await, need return by [@​radiorz](https://togithub.com/radiorz) in [fastify/fastify#4429 - fix: re-thrown error crash by [@​climba03003](https://togithub.com/climba03003) in [fastify/fastify#4488 - build(deps): bump thollander/actions-comment-pull-request from 1 to 2 by [@​dependabot](https://togithub.com/dependabot) in [fastify/fastify#4489 - build(deps): bump xt0rted/markdownlint-problem-matcher from 1.1.0 to 2.0.0 by [@​dependabot](https://togithub.com/dependabot) in [fastify/fastify#4490 - improve `setErrorHandler` example by [@​trim21](https://togithub.com/trim21) in [fastify/fastify#4484 ##### New Contributors - [@​marcoreni](https://togithub.com/marcoreni) made their first contribution in [fastify/fastify#4436 - [@​SaumyaBhushan](https://togithub.com/SaumyaBhushan) made their first contribution in [fastify/fastify#4448 - [@​nlf](https://togithub.com/nlf) made their first contribution in [fastify/fastify#4449 - [@​polRk](https://togithub.com/polRk) made their first contribution in [fastify/fastify#4471 - [@​radiorz](https://togithub.com/radiorz) made their first contribution in [fastify/fastify#4429 - [@​trim21](https://togithub.com/trim21) made their first contribution in [fastify/fastify#4484 **Full Changelog**: fastify/fastify@v4.10.2...v4.11.0 </details> <details> <summary>typicode/husky</summary> ### [`v8.0.3`](https://togithub.com/typicode/husky/releases/tag/v8.0.3) [Compare Source](https://togithub.com/typicode/husky/compare/v8.0.2...v8.0.3) - fix: add git not installed message [#​1208](https://togithub.com/typicode/husky/issues/1208) </details> <details> <summary>jest-community/jest-extended</summary> ### [`v3.2.1`](https://togithub.com/jest-community/jest-extended/releases/tag/v3.2.1) [Compare Source](https://togithub.com/jest-community/jest-extended/compare/v3.2.0...v3.2.1) #### What's Changed - Change return type in Expect interface to void by [@​keeganwitt](https://togithub.com/keeganwitt) in [jest-community/jest-extended#535 - Create pass/fail error messages only if required by [@​overlookmotel](https://togithub.com/overlookmotel) in [jest-community/jest-extended#545 #### New Contributors - [@​verdecchia](https://togithub.com/verdecchia) made their first contribution in [jest-community/jest-extended#541 - [@​Unclemortuary](https://togithub.com/Unclemortuary) made their first contribution in [jest-community/jest-extended#540 **Full Changelog**: jest-community/jest-extended@v3.2.0...v3.2.1 </details> <details> <summary>harttle/liquidjs</summary> ### [`v10.4.0`](https://togithub.com/harttle/liquidjs/blob/HEAD/CHANGELOG.md#​1040-httpsgithubcomharttleliquidjscomparev1033v1040-2023-01-02) [Compare Source](https://togithub.com/harttle/liquidjs/compare/v10.3.3...v10.4.0) ##### Features - support `not` operator, [#​575](https://togithub.com/harttle/liquidjs/issues/575) ([3f21382](https://togithub.com/harttle/liquidjs/commit/3f21382d43cafa1e32162e58adabd22d5c3709ed)) - support calling `date` without format string, [#​573](https://togithub.com/harttle/liquidjs/issues/573) ([aafaa0b](https://togithub.com/harttle/liquidjs/commit/aafaa0b4f9e84f466fbcc2cb2ae37fe8704c5272)) #### [10.3.3](https://togithub.com/harttle/liquidjs/compare/v10.3.2...v10.3.3) (2022-12-18) ##### Bug Fixes - type compatible with v9 tag definition, support `Context` as scope in various render APIs, [#​570](https://togithub.com/harttle/liquidjs/issues/570) ([fb6a9f8](https://togithub.com/harttle/liquidjs/commit/fb6a9f8717cd57522d53687da7e4718b28a7f68a)) #### [10.3.2](https://togithub.com/harttle/liquidjs/compare/v10.3.1...v10.3.2) (2022-12-13) ##### Bug Fixes - re-export error classes, [#​569](https://togithub.com/harttle/liquidjs/issues/569) ([2663ee1](https://togithub.com/harttle/liquidjs/commit/2663ee16a066c74cbd387fe40154fdeb2136f35a)) #### [10.3.1](https://togithub.com/harttle/liquidjs/compare/v10.3.0...v10.3.1) (2022-12-12) ##### Bug Fixes - support `Context` as `evalValue` parameter, [#​568](https://togithub.com/harttle/liquidjs/issues/568) ([0f4916b](https://togithub.com/harttle/liquidjs/commit/0f4916bc5a93f5e744e4246336c68f2e89774272)) </details> <details> <summary>dividab/tsconfig-paths</summary> ### [`v4.1.2`](https://togithub.com/dividab/tsconfig-paths/blob/HEAD/CHANGELOG.md#​412---2023-01-02) [Compare Source](https://togithub.com/dividab/tsconfig-paths/compare/v4.1.1...v4.1.2) ##### Fixed - Bump JSON5 dependency to 2.2.2 to fix CVE-2022-46175. See PR [#​232](https://togithub.com/dividab/tsconfig-paths/pull/232). Thanks to [@​oparisblue](https://togithub.com/oparisblue) for this PR! </details> --- ### Configuration 📅 **Schedule**: Branch creation - "every weekend" (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://togithub.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/PKUHPC/SCOW). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC43NC4yIiwidXBkYXRlZEluVmVyIjoiMzQuNzQuMiJ9--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Checklist
npm run test
andnpm run benchmark
and the Code of conduct
The example in document will make fastify never send a response if handle throw a error which is not expected error. For example if a handle
throw new Error(...)
. Original document is not clear about this and example doesn't handle it.Original document make me confused, I assumed that rest of errors will be handled automatically without returning them, but turns out it doesn't. I'm not sure if "error handler return unhanded error and pop them to parent handler" it expected behavior, but looks like it is, so I create this pr to fix them example. And if it's, I hope the document of
setErrorHandler
could be updated to o, so users can know they can pop error to default error handler. https://www.fastify.io/docs/latest/Reference/Server/#seterrorhandlerlike this:
GET /bad-case