Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/marvinhagemeister/errorstacks
Tiny library to parse error stack traces
https://github.com/marvinhagemeister/errorstacks
error parser parsing stacktracke
Last synced: about 6 hours ago
JSON representation
Tiny library to parse error stack traces
- Host: GitHub
- URL: https://github.com/marvinhagemeister/errorstacks
- Owner: marvinhagemeister
- License: mit
- Created: 2020-04-03T20:13:26.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-11-08T23:04:27.000Z (about 1 year ago)
- Last Synced: 2024-12-18T11:05:37.618Z (7 days ago)
- Topics: error, parser, parsing, stacktracke
- Language: TypeScript
- Size: 139 KB
- Stars: 104
- Watchers: 4
- Forks: 5
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# errorstacks
Simple parser for Error stack traces.
Currently supported browsers/platforms:
- Firefox
- Chrome
- Edge
- Node## Usage
Install `errorstacks` via your package manager of choice. Here we'll use `npm`.
```bash
npm install errorstacks
```Example code:
```js
import { parseStackTrace } from 'errorstacks';function foo() {
throw new Error('fail');
}try {
foo();
} catch (err) {
const parsed = parseStackTrace(err.stack);
console.log(parsed);
// Logs:
// [
// {
// line: 4,
// column: 8,
// type: '',
// name: 'foo',
// raw: ' at foo (/my-project/foo.ts:4:8)'
// },
// ]
```_Note: `type` will be the string `"native"` if native code execution was detected._
## License
MIT, see [the license file](./LICENSE)