Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
better-stack-traces
Advanced tools
Readme
Ever find yourself digging line-by-line through a Javascript stack trace to find the "real" error?
Error: ENOENT, no such file or directory '/bad/file/path'
at Object.openSync (fs.js:230:18)
at Object.readFileSync (fs.js:120:15)
at readMyFile (/path/to/some/code/example.js:10:6)
at doStuff (/path/to/some/code/example.js:5:10)
at Object.<anonymous> (/path/to/some/code/example.js:13:1)
at Module._compile (module.js:441:26)
at Object..js (module.js:459:10)
at Module.load (module.js:348:31)
With better-stack-traces
, you get inline code snippets instead:
Error: ENOENT, no such file or directory '/bad/file/path'
at Object.openSync (fs.js:230:18)
at Object.readFileSync (fs.js:120:15)
at readMyFile (/path/to/some/code/example.js:10:6)
──────────────────────────────────────────────────
8 »
9 » function readMyFile(filePath) {
10 » fs.readFileSync(filePath);
•••••••••••
11 » }
12 »
13 » doStuff(readMyFile)
at doStuff (/path/to/some/code/example.js:5:10)
───────────────────────────────────────────────
3 »
4 » function doStuff(readCallback) {
5 » return readCallback("/bad/file/path");
••••••••••••••
6 » }
7 »
8 »
at Object.<anonymous> (/path/to/some/code/example.js:13:1)
──────────────────────────────────────────────────────────
11 » }
12 »
13 » doStuff(readMyFile)
••••••
at Module._compile (module.js:441:26)
at Object..js (module.js:459:10)
at Module.load (module.js:348:31)
npm install better-stack-traces
require("better-stack-traces").register()
require("better-stack-traces/register")
. This is useful for
tools that have commandline options like --require
in mocha.If you develop with CoffeeScript,
better-stack-traces
will automatically compile .coffee
files when
rendering the trace. Maybe someday we will have
proper
line number mapping,
but until then better stack traces might help your sanity :)
Stack traces not quite better enough? There are a few options to tweak the output:
require("better-stack-traces").register({
before: 2, // number of lines to show above the error
after: 3, // number of lines to show below the error
maxColumns: 80, // maximum number of columns to output in code snippets
collapseLibraries: /node_modules/ // omit code snippets from paths that match the given regexp (ignores node_modules by default)
})
If you want to get really fancy, take a look at the library itself. You can
subclass BetterStackTrace
and register your customized subclass instead.
If you find better-stack-traces
useful, you might be interested in these:
collapseLibraries
FAQs
Detailed stack traces with code snippets.
The npm package better-stack-traces receives a total of 602 weekly downloads. As such, better-stack-traces popularity was classified as not popular.
We found that better-stack-traces 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.