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

abend

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

abend - npm Package Compare versions

Comparing version 0.0.0 to 0.0.1

internal.js

6

abend.js

@@ -1,4 +0,2 @@

function abend (error) {
if (error) throw error
}
module.exports = abend
var internal = require('./internal')
module.exports = internal.checkError(internal.createThrower)
{
"name": "abend",
"version": "0.0.0",
"version": "0.0.1",
"author": "Alan Gutierrez <alan@prettyrobots.com>",

@@ -5,0 +5,0 @@ "description": "Throw an error if there is an error.",

@@ -5,7 +5,15 @@ # Abend

```
function abend (error) {
if (error) throw error
if (error) {
setImmediate(function () { throw error })
}
}
```
This is an essential function for error-frist callback programming.
The `abend` function will throw an error on the next tick. By throwing the error
outside of the stack that invoked it we can be certain that the error will not
be caught by any `catch` blocks, that it will create an uncaught exception and
terminate the program.
require('proof')(1, prove)
function prove (assert) {
var abend = require('../..')
try {
abend(new Error('thrown'))
} catch (error) {
assert(error.message, 'thrown', 'caught')
}
try {
abend(null, 1)
} catch (error) {
assert(false, 'should not do anything')
}
assert(require('../..'), 'require')
}
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