Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
An extended Error class that envelops a parent error, such that the stack trace contains the causation
Errlop is a utility for creating and managing error objects in JavaScript. It allows you to wrap errors, add additional context, and handle them in a more structured way.
Creating a basic Errlop error
This feature allows you to create a basic Errlop error with a custom message.
const Errlop = require('errlop');
const error = new Errlop('Something went wrong');
console.log(error.message);
Wrapping an existing error
This feature allows you to wrap an existing error with a new Errlop error, preserving the original error as the cause.
const Errlop = require('errlop');
const originalError = new Error('Original error');
const wrappedError = new Errlop('Something went wrong', originalError);
console.log(wrappedError.message);
console.log(wrappedError.cause);
Adding additional context
This feature allows you to add additional context to an Errlop error, which can be useful for debugging.
const Errlop = require('errlop');
const error = new Errlop('Something went wrong', { context: 'Additional context' });
console.log(error.context);
VError is a library for creating and managing nested errors in JavaScript. It allows you to wrap errors and add additional context, similar to Errlop. However, VError provides more advanced features for error handling, such as error codes and multi-error support.
Error Stack Parser is a library for parsing and extracting information from error stack traces. While it does not provide the same error wrapping functionality as Errlop, it is useful for analyzing and debugging errors by extracting meaningful information from stack traces.
Stacktrace.js is a library for generating, parsing, and analyzing stack traces in JavaScript. It provides more advanced stack trace manipulation capabilities compared to Errlop, but does not focus on error wrapping and context management.
An extended Error class that envelops a parent error, such that the stack trace contains the causation
npm install --save errlop
require('errlop')
<script type="module">
import * as pkg from '//dev.jspm.io/errlop'
</script>
This package is published with the following editions:
errlop
aliases errlop/index.js
which uses Editions to automatically select the correct edition for the consumers environmenterrlop/source/index.js
is esnext source code with require for moduleserrlop/edition-browsers/index.js
is esnext compiled for browsers with require for moduleserrlop/edition-node-0.8/index.js
is esnext compiled for node.js 0.8 with require for modulesThis project provides its type information via inline JSDoc Comments. To make use of this in TypeScript, set your maxNodeModuleJsDepth
compiler option to 5
or thereabouts. You can accomlish this via your tsconfig.json
file like so:
{
"compilerOptions": {
"maxNodeModuleJsDepth": 5
}
}
const Errlop = require('errlop')
const a = new Errlop('AError')
const b = new Errlop('BError', a)
const c = Errlop.create('CError', b)
console.log(c.stack)
/*
Error: CError
at Function.create (/Users/balupton/Projects/active/errlop/source/index.js:92:10)
at Object.<anonymous> (/Users/balupton/Projects/active/errlop/example.js:6:18)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
at startup (internal/bootstrap/node.js:266:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:596:3)
↳ Error: BError
at Object.<anonymous> (/Users/balupton/Projects/active/errlop/example.js:5:11)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
at startup (internal/bootstrap/node.js:266:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:596:3)
↳ Error: AError
at Object.<anonymous> (/Users/balupton/Projects/active/errlop/example.js:4:11)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
at startup (internal/bootstrap/node.js:266:19)
*/
console.log(c.orphanStack)
/*
Error: CError
at Function.create (/Users/balupton/Projects/active/errlop/source/index.js:92:10)
at Object.<anonymous> (/Users/balupton/Projects/active/errlop/example.js:6:18)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
at startup (internal/bootstrap/node.js:266:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:596:3)
*/
Discover the release history by heading on over to the HISTORY.md
file.
Discover how you can contribute by heading on over to the CONTRIBUTING.md
file.
These amazing people are maintaining this project:
No sponsors yet! Will you be the first?
These amazing people have contributed code to this project:
Discover how you can contribute by heading on over to the CONTRIBUTING.md
file.
Unless stated otherwise all works are:
and licensed under:
v1.1.0 2018 December 28
FAQs
An extended Error class that envelops a parent error, such that the stack trace contains the causation
The npm package errlop receives a total of 693,806 weekly downloads. As such, errlop popularity was classified as popular.
We found that errlop demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.