You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

hacktrace

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hacktrace

Hack in your own backtraces


Version published
Weekly downloads
0
Maintainers
1
Install size
4.57 kB
Created
Weekly downloads
 

Readme

Source

hacktrace build status

NPM package to hack stack traces. I wrote this to easily make custom backtraces for literapi — since I parse markdown documents for tests, it's more useful to output the line from markdown that started the error than just showing a reference to some internal line of code.

To use hacktrace, simply wrap each level of "stack" in a call to hacktrace.

hacktrace = require('hacktrace')

try {
  hacktrace({ file: 'foo.js', line: 8, column: 4, label: 'barf' }, function() {
    hacktrace({ line_offset: 5 }, function() {
      throw new Error("ONOZ")
    })
  })
} catch (e) {
  e.stack = e.hacktrace
  throw e
}

The output from this will be:

Error: ONOZ
    at foo.js:13
    at barf (foo.js:8:4)

Keywords

FAQs

Package last updated on 18 Oct 2012

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc