Package Exports
- errno-codes
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (errno-codes) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Node Error
Node.js project
Exposes the errno codes
Show me! | Availability | Compatibility | Documentation
Version: 1.0.2
When you are writing a node.js module you"ll probably deal with errors. If you get a predefined error you can just throw it via a callback but if you want to instantiate a predefined one you need an errno code. Node.js does not expose these errors. Furthermore, they"re not the standard errno codes. They are defined at deps/uv/include/uv.h.
This module eases the error management providing predefined Error instances for every errno code and the ability to create customized errors.
Show me! ↑
var Error = require ("errno-codes");
console.log (Error.get (Error.ENOENT));
var errno = Error.getNextAvailableErrno ();
Error.create (errno, "TEST1", "test 1");
console.log (Error.get (Error.TEST1));
console.log (Error.get ("TEST1"));
console.log (Error.get (errno));
/*
Prints:
{ [Error: ENOENT]
errno: 34,
code: "ENOENT",
description: "no such file or directory" }
{ [Error: TEST1] errno: 100, code: "TEST1", description: "test 1" }
{ [Error: TEST1] errno: 100, code: "TEST1", description: "test 1" }
{ [Error: TEST1] errno: 100, code: "TEST1", description: "test 1" }
*/Availability ↑
Via npm:
npm install errno-codesCompatibility ↑
✔ Node *