Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
An asynchronous domain-based exception handler with long stack traces for node.js
An asynchronous domain-based try/catch exception handler with (optional) long stack traces for node.js
With the update to 0.2.0
Also, trycatch conforms to try/catch V8 best practices.
npm install trycatch
var trycatch = require('trycatch')
trycatch(fnTry, fnCatch)
Optional Long-Stack-Traces:
// Because trycatch shims all native I/O calls,
// it must be required & configured with 'long-stack-traces' before any other modules.
var trycatch = require('trycatch')
trycatch.configure({'long-stack-traces': true})
trycatch(fnTry, fnCatch)
Colors:
var trycatch = require('trycatch')
trycatch.configure({
colors: {
// 'none' or falsy values will omit
'node': 'none',
'node_modules': false,
'default': 'yellow'
}
})
trycatch(fnTry, fnCatch)
Advanced Formatting:
var trycatch = require('trycatch')
trycatch.configure({
format: function(line) {
// Alter final output (falsy values will omit)
return line
}
})
trycatch(fnTry, fnCatch)
var trycatch = require("trycatch"),
_ = require('underscore')._
trycatch(function() {
_.map(['Error 1', 'Error 2'], function foo(v) {
setTimeout(function() {
throw new Error(v)
}, 10)
})
}, function(err) {
console.log("Async error caught!\n", err.stack);
});
See the /test
and examples
directories for more use cases.
http.createServer(function(req, res) {
trycatch(function() {
setTimeout(function() {
throw new Error('Baloney!');
}, 1000);
}, function(err) {
res.writeHead(500);
res.end(err.stack);
});
}).listen(8000);
Visit http://localhost:8000 and get your 500.
FAQs
An asynchronous domain-based exception handler with long stack traces for node.js
The npm package trycatch receives a total of 555 weekly downloads. As such, trycatch popularity was classified as not popular.
We found that trycatch 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.