Error codes for Node.js > 8.0
Why
Recently node.js added Error#code https://medium.com/the-node-js-collection/node-js-errors-changes-you-need-to-know-about-dc8c82417f65
But currently it doesn't export the "strings" via internal module.
So I've created this static ES6 Modules that exports constants.
So you can figure out typos during bundle time.
Usage:
The modules exports constants
ES6+:
; try ; catch err if errcode === ERR_ASSERTION console;
CommonJS:
const errorCodes = ; try ; catch err if errcode === errorCodesERR_ASSERTION console;
Building
Run gen.js node
which fetches the latest error codes from node.js /lib/internal/errors.js
.
Parses with babylon, and creates error_codes.mjs
System Errors with libUV hasnt been implemented yet!
TODO:
Configure tests/linter.
Implement libuv errors.