Last active
May 12, 2024 03:15
-
-
Save phanect/d2548106b1c6cbb6142eb07c0a87829d to your computer and use it in GitHub Desktop.
Experiment if error stops the Node.js process as a failure. (Tested on Node.js v22.1.0)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { fn } = require("./async-err-lib.cjs"); | |
(async () => { | |
await fn(); | |
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { fn } from "./async-err-lib.js"; | |
await fn(); // Error is shown as expected. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports.fn = async () => { | |
throw new Error("By this error, the process would fail."); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const fn = async () => { | |
throw new Error("By this error, the process would fail."); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment