[READ-ONLY] Mirror of https://github.com/danielroe/errx. Zero dependency library to capture and parse stack traces in Node, Bun, Deno and more.
error
stack-trace
1.6 kB
61 lines
1# errx
2
3[![npm version][npm-version-src]][npm-version-href]
4[![npm downloads][npm-downloads-src]][npm-downloads-href]
5[![Github Actions][github-actions-src]][github-actions-href]
6[![Codecov][codecov-src]][codecov-href]
7
8> Zero dependency library to capture and parse stack traces in Node, Bun, Deno and more.
9
10## Usage
11
12Install package:
13
14```sh
15# npm
16npm install errx
17
18# pnpm
19pnpm install errx
20```
21
22```js
23import { captureRawStackTrace, captureStackTrace, parseRawStackTrace } from 'errx'
24
25// returns raw string stack trace
26captureRawStackTrace()
27// returns parsed stack trace
28captureStackTrace()
29
30console.log(captureStackTrace())
31// [{
32// function: undefined,
33// source: 'file:///code/unjs/errx/playground/index.js',
34// line: '5',
35// column: '13'
36// }]
37```
38
39## 💻 Development
40
41- Clone this repository
42- Enable [Corepack](https://github.com/nodejs/corepack) using `corepack enable`
43- Install dependencies using `pnpm install`
44- Run interactive tests using `pnpm dev`
45
46## License
47
48Made with ❤️
49
50Published under [MIT License](./LICENCE).
51
52<!-- Badges -->
53
54[npm-version-src]: https://npmx.dev/api/registry/badge/version/errx
55[npm-version-href]: https://npmx.dev/package/errx
56[npm-downloads-src]: https://npmx.dev/api/registry/badge/downloads/errx
57[npm-downloads-href]: https://npm.chart.dev/errx
58[github-actions-src]: https://img.shields.io/github/actions/workflow/status/unjs/errx/ci.yml?branch=main&style=flat-square
59[github-actions-href]: https://github.com/unjs/errx/actions?query=workflow%3Aci
60[codecov-src]: https://img.shields.io/codecov/c/gh/unjs/errx/main?style=flat-square
61[codecov-href]: https://codecov.io/gh/unjs/errx