
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Generic Error handler
npm i thrown
// logger function is optional
// logger => internal logger
import errorHandler, { genericError, logger } from 'thrown'
// without options
function thisIsFunction() {
try {
throw genericError('this is message', { /* ... */ })
} catch (err) {
errorHandler(err)
}
}
// with options : case 1
function thisIsFunction() {
try {
throw genericError.create('prefix >')('this is message', { /* ... */ })
// or
throw genericError.create({ prefix: 'prefix >' })('this is message', { /* ... */ })
} catch (err) {
errorHandler(err)
}
}
// with options : case 2
function thisIsFunction() {
try {
throw genericError('this is message', { /* ... */ })
} catch (err) {
errorHandler.extra({
// if set `externalLogger`, no use internal logger
// internal logger uses `console.group`
externalLogger: (message, err, stack) => {
console.log(message, err);
console.log(stack);
}
})(err)
}
}
// with options : case 3
function thisIsFunction() {
try {
throw genericError.('this is message', { /* ... */ })
} catch (err) {
errorHandler.extra({
// additional information
handler: (err) => {
// compute something
// this object will combine with original error object
// should be an object (not array)
return { computedErr }
}
})(err)
}
}
import errorHandler from 'thrown'
try {
throw new Error('this is error')
} catch (err) {
// all options are optional
errorHandler.extra({
// no display in production
mode: process.env.NODE_ENV,
// css text eg. 'font-size: 10px;'
style: '',
// default <thrown>
name: 'any name',
// default true (group or groupCollapsed)
expanded: true,
// default false (console.trace), if trace false, it uses error.stack
trace: false,
// use external logger
externalLogger: (message, err, stack) => {
console.log(message, err);
console.log(stack);
},
// combine additional information with original error
handler: (err) => {
const computedErr = {
return { computedErr }
}
})(err)
}
MIT
FAQs
Generic Error Handler
The npm package thrown receives a total of 2 weekly downloads. As such, thrown popularity was classified as not popular.
We found that thrown demonstrated a not healthy version release cadence and project activity because the last version was released 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.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.