MCPcopy Index your code
hub / github.com/antfu-collective/error-stack-parser-es

github.com/antfu-collective/error-stack-parser-es @v2.0.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release v2.0.1 ↗ · + Follow
27 symbols 56 edges 7 files 0 documented · 0% 2 cross-repo links
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

error-stack-parser-es

NPM version

A port of stacktracejs/error-stack-parser, rewrite with TypeScript and ES Modules.

Usage

import { parse } from 'error-stack-parser-es'

const stacktrace = parse(new Error('BOOM!'))

Refer to stacktracejs/error-stack-parser for more details.

Lite API

Additionally, this fork added a lite version of the API representation for the stack frames. You can import it from error-stack-parser-es/lite. For example, line and col instead of lineNumber and columnNumber.

import { parse } from 'error-stack-parser-es/lite'

const stacktrace = parse(new Error('BOOM!'))
// [{ file: 'file.js', name: 'method', line: 1, col: 2}]

It also allows you to parse directly from a stacktrace string (which does not support Opera stacktrace format).

import { parseStack } from 'error-stack-parser-es/lite'

const stacktrace = parseStack('Error\n    at method (file.js:1:2)')
// [{ file: 'file.js', name: 'method', line: 1, col: 2}]

License

MIT License © 2023-PRESENT Anthony Fu MIT License © 2017 Eric Wendelin

Extension points exported contracts — how you extend this code

CustomMatchers (Interface)
(no doc)
test/fixtures.test.ts
StackFrame (Interface)
(no doc)
src/types.ts
Assertion (Interface)
(no doc)
test/fixtures.test.ts
StackFrameLite (Interface)
(no doc)
src/types.ts
AsymmetricMatchersContaining (Interface)
(no doc)
test/fixtures.test.ts
ParseOptions (Interface)
(no doc)
src/types.ts

Core symbols most depended-on inside this repo

parse
called by 25
src/lite.ts
stackframesLiteToStackframes
called by 7
src/index.ts
applySlice
called by 5
src/lite.ts
extractLocation
called by 3
src/lite.ts
parseV8OrIeString
called by 2
src/lite.ts
parseFFOrSafariString
called by 2
src/lite.ts
parseV8OrIE
called by 1
src/lite.ts
parseFFOrSafari
called by 1
src/lite.ts

Shape

Function 21
Interface 6

Languages

TypeScript100%

Modules by API surface

src/lite.ts12 symbols
src/index.ts8 symbols
test/fixtures.test.ts4 symbols
src/types.ts3 symbols

Used by 2 indexed graphs manifest dependencies, hub-wide

For agents

$ claude mcp add error-stack-parser-es \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact