Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

errno

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

errno - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

cli.js

2

custom.js

@@ -17,6 +17,6 @@ function init (name, message, cause) {

// Ender error factory
function createError (errno, name, proto) {
var err = function (message, cause) {
init.call(this, name, message, cause)
//TODO: the specificity here is stupid, errno should be available everywhere
if (name == 'FilesystemError') {

@@ -23,0 +23,0 @@ this.code = this.cause.code

@@ -281,2 +281,17 @@ var all = module.exports.all = [

"description": "read-only file system"
},
{
"errno": 57,
"code": "ENODEV",
"description": "no such device"
},
{
"errno": 58,
"code": "ESPIPE",
"description": "invalid seek"
},
{
"errno": 59,
"code": "ECANCELED",
"description": "operation canceled"
}

@@ -343,2 +358,5 @@ ]

, '56': all[55]
, '57': all[56]
, '58': all[57]
, '59': all[58]
}

@@ -404,4 +422,8 @@

, 'EROFS': all[55]
, 'ENODEV': all[56]
, 'ESPIPE': all[57]
, 'ECANCELED': all[58]
}
module.exports.custom = require("./custom")(module.exports)
module.exports.custom = require("./custom")(module.exports)
{
"author": "@rvagg <rod@vagg.org>"
, "name": "errno"
"name": "errno"
, "authors": [
"Rod Vagg @rvagg <rod@vagg.org> (https://github.com/rvagg)"
]
, "description": "libuv errno details exposed"
, "keywords": [ "errors", "errno", "libuv" ]
, "version": "0.0.2"
, "version": "0.0.3"
, "main": "errno.js"
, "dependencies": {}
, "bin": {
"errno": "./cli.js"
}
, "devDependencies": {
"request": "*"
}
, "optionalDependencies": {}
, "engines": {
"node": "*"
, "repository": {
"type": "git"
, "url": "https://github.com/rvagg/node-errno.git"
}
}
, "license" : "MIT"
}
# node-errno
[libuv](https://github.com/joyent/libuv) errno details exposed. Available in npm as *errno*
Ever find yourself needing more details about NodeJS errors? Me too, so *node-errno* contains the errno mappings direct from libuv so you can use them in your code.
Better [libuv](https://github.com/joyent/libuv)/[Node.js](http://nodejs.org) error handling & reporting. Available in npm as *errno*.
* [errno exposed](#errnoexposed)
* [Custom errors](#customerrors)
<a name="errnoexposed"></a>
## errno exposed
Ever find yourself needing more details about Node.js errors? Me too, so *node-errno* contains the errno mappings direct from libuv so you can use them in your code.
**By errno:**

@@ -57,2 +64,59 @@

**Use as a command line tool:**
```
~ $ errno 53
{
"errno": 53,
"code": "ENOTEMPTY",
"description": "directory not empty"
}
~ $ errno EROFS
{
"errno": 56,
"code": "EROFS",
"description": "read-only file system"
}
~ $ errno foo
No such errno/code: "foo"
```
Supply no arguments for the full list. Error codes are processed case-insensitive.
You will need to install with `npm install errno -g` if you want the `errno` command to be available without supplying a full path to the node_modules installation.
<a name="customerrors"></a>
## Custom errors
Use `errno.custom.createError()` to create custom `Error` objects to throw around in your Node.js library. Create error heirachies so `instanceof` becomes a useful tool in tracking errors. Call-stack is correctly captured at the time you create an instance of the error object, plus a `cause` property will make available the original error object if you pass one in to the constructor.
```js
var errno = require('errno')
var MyError = errno.custom.createError('MyError') // inherits from Error
var SpecificError = errno.custom.createError('SpecificError', MyError) // inherits from MyError
var OtherError = errno.custom.createError('OtherError', MyError)
// use them!
if (condition) throw new SpecificError('Eeek! Something bad happened')
if (err) return callback(new OtherError(err))
```
Also available is a `errno.custom.FilesystemError` with in-built access to errno properties:
```js
fs.readFile('foo', function (err, data) {
if (err) return callback(new errno.custom.FilesystemError(err))
// do something else
})
```
The resulting error object passed through the callback will have the following properties: `code`, `errno`, `path` and `message` will contain a descriptive human-readable message.
## Contributors
* [bahamas10](https://github.com/bahamas10) (Dave Eddy) - Added CLI
## Copyright & Licence
*Copyright (c) 2012 [Rod Vagg](https://github.com/rvagg) ([@rvagg](https://twitter.com/rvagg))*

@@ -59,0 +123,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc