今月20日にInitial Releaseが予定されているNode.js v15ですが、ここでのunhandled rejectionの挙動変更について解説します。 unhandled rejectionとは async関数内でthrowされたエラーや、rejectされたPromiseが、.catch()などでハンドリングされずにrejectされたままになっている状態を、unhandled rejction(またはunhandled promise rejction)と呼びます。Node.js v14では、unhandled rejectionが発生すると次のような警告が出力されます。 $ node -e "Promise.reject()" (node:22145) UnhandledPromiseRejectionWarning: undefined (Use `node --trac
![Node.js v15ではunhandled rejectionでプロセスがエラー終了する](https://cdn-ak-scissors.b.st-hatena.com/image/square/1eabcf9ec67f340d3d245b86e5b74f3acc3e5fe7/height=288;version=1;width=512/https%3A%2F%2Fres.cloudinary.com%2Fzenn%2Fimage%2Fupload%2Fs--MX44A9_z--%2Fc_fit%252Cg_north_west%252Cl_text%3Anotosansjp-medium.otf_55%3ANode.js%252520v15%2525E3%252581%2525A7%2525E3%252581%2525AFunhandled%252520rejection%2525E3%252581%2525A7%2525E3%252583%252597%2525E3%252583%2525AD%2525E3%252582%2525BB%2525E3%252582%2525B9%2525E3%252581%25258C%2525E3%252582%2525A8%2525E3%252583%2525A9%2525E3%252583%2525BC%2525E7%2525B5%252582%2525E4%2525BA%252586%2525E3%252581%252599%2525E3%252582%25258B%252Cw_1010%252Cx_90%252Cy_100%2Fg_south_west%252Cl_text%3Anotosansjp-medium.otf_37%3AKenji%252520Imamula%252Cx_203%252Cy_121%2Fg_south_west%252Ch_90%252Cl_fetch%3AaHR0cHM6Ly9saDMuZ29vZ2xldXNlcmNvbnRlbnQuY29tL2EtL0FPaDE0R2lPSW80M3dZc1FTNXFyNnpVYnN4eUhHQU1tNzJNemdYbDJRa1pGZ2c9czI1MC1j%252Cr_max%252Cw_90%252Cx_87%252Cy_95%2Fv1627283836%2Fdefault%2Fog-base-w1200-v2.png)