Skip to content

Parses stack traces from browsers, and tries to extract as much information from them as possible

Notifications You must be signed in to change notification settings

errorception/browser-stack-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

browser-stack-parser

A Node.js module to parse JavaScript stack traces generated by browsers, and try to extract as much information from them as possible.

Uses code from the awesome stacktracejs project.

Parses stack traces from Chrome, Firefox, Opera, Safari and IE>=10.

Example

var parse = require("browser-stack-parser");

var stack = "ReferenceError: nonExistantFunction is not defined\n    at fn3 (http://localhost:3000/stackgen.js:10:2)\n    at fn2 (http://localhost:3000/stackgen.js:6:2)\n    at fn1 (http://localhost:3000/stackgen.js:2:2)\n    at http://localhost:3000/stackgen.js:14:2"

console.log(parse(stack));

/*
	Should output the following:

	[
		{url: "http://localhost:3000/stackgen.js", func: "fn3", line: 10, column: 2},
		{url: "http://localhost:3000/stackgen.js", func: "fn2", line:  6, column: 2},
		{url: "http://localhost:3000/stackgen.js", func: "fn1", line:  2, column: 2},
		{url: "http://localhost:3000/stackgen.js", func: "<unknown>", line:  14, column: 2}
	]

*/

Installation

npm install browser-stack-parser

To run tests, cd to the browser-stack-parser directory, and run npm test.

If you want to add a test for different browsers, you can simply open test/helpers/index.html in a browser to see the stacktrace generated by that browser.

License

MIT

About

Parses stack traces from browsers, and tries to extract as much information from them as possible

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published