Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

stack-trace-parser

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stack-trace-parser

parse stack trace

  • 0.0.5
  • npm
  • Socket score

Version published
Weekly downloads
5
Maintainers
1
Weekly downloads
 
Created
Source

stack-trace-parser Build Status

NPM

stack-trace-parser parses stack traces

Examples

Error exception

From example.js:

var stackTraceParser = require('./src/parser')
    assert = require('assert');

try {
  throw new Error('just got real');
}
catch (exception) {
  var stackTrace = stackTraceParser.parse(exception);

  assert(stackTrace.type === 'Error', "Expected stack trace type to be Error but instead it is " + stackTrace.type);
  assert.strictEqual(stackTrace.message, 'just got real', "Expected stack trace message to be 'just got real' but instead it is: " + stackTrace.message);
  assert(stackTrace[0].fileName.indexOf('example.js') !== -1, "Expected file name to contain 'example.js'!");
  assert.strictEqual(stackTrace[0].lineNumber, 5, "Expected line number to match line 5 of this file!");
  assert.strictEqual(stackTrace[0].columnNumber, 9, "Expected column number to match column 9 of this file!");
}

ReferenceError exception

From example-undefined.js:

var stackTraceParser = require('./src/parser')
    assert = require('assert');

try {
  d = d * 2;
}
catch (exception) {
  var stackTrace = stackTraceParser.parse(exception);

  assert(stackTrace.type === 'ReferenceError', "Expected stack trace type to be ReferenceError but instead it is " + stackTrace.type);
  assert.strictEqual(stackTrace.message, 'd is not defined', "Expected stack trace message to be 'd is not defined' but instead it is: " + stackTrace.message);
  assert(stackTrace[0].fileName.indexOf('example-undefined.js') !== -1, "Expected file name to contain 'example-undefined.js'!");
  assert.strictEqual(stackTrace[0].lineNumber, 5, "Expected line number to match line 5 of this file not " + stackTrace[0].lineNumber);
  assert.strictEqual(stackTrace[0].columnNumber, 7, "Expected column number to match column 7 of this file not " + stackTrace[0].columnNumber);
}

FAQs

Package last updated on 16 Feb 2014

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

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc