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.1 to 0.0.2

2

abend.js
var internal = require('./internal')
module.exports = internal.checkError(internal.createThrower)
module.exports = internal.checkError(internal.createThrower, process.stderr)

@@ -1,5 +0,6 @@

exports.checkError = function (createHandler) {
exports.checkError = function (createHandler, stderr) {
return function (error) {
if (error) {
setImmediate(createHandler(error))
setImmediate(createHandler(error, stderr))
throw error
}

@@ -9,4 +10,7 @@ }

exports.createThrower = function (error) {
return function () { throw error }
exports.createThrower = function (error, stderr) {
return function () {
stderr.write('WARNING: rethrowning caught error\n')
throw error
}
}
{
"name": "abend",
"version": "0.0.1",
"version": "0.0.2",
"author": "Alan Gutierrez <alan@prettyrobots.com>",

@@ -26,3 +26,3 @@ "description": "Throw an error if there is an error.",

{
"proof": "0.0.52"
"proof": "0.0.56"
},

@@ -29,0 +29,0 @@ "scripts":

@@ -1,9 +0,12 @@

require('proof')(2, prove)
require('proof')(3, prove)
function prove (assert, callback) {
var internal = require('../../internal')
var stream = require('stream')
var stderr = new stream.PassThrough
try {
internal.createThrower(new Error('thrown'))()
internal.createThrower(new Error('thrown'), stderr)()
} catch (error) {
assert(stderr.read().toString(), 'WARNING: rethrowning caught error\n', 'stderr')
assert(error.message, 'thrown', 'thrower')

@@ -13,8 +16,14 @@ }

var handler = internal.checkError(function (error) {
assert(error.message, 'given', 'abended')
callback()
})
return function () {
assert(error.message, 'given', 'abended')
callback()
}
}, stderr)
handler()
handler(new Error('given'))
try {
handler(new Error('given'))
} catch (error) {
// swallow error to test hedge.
}
}

Sorry, the diff of this file is not supported yet

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