https://github.com/mikeludemann/error-handling-stack-traces
A simple helpful small library to parse and handle the error stack traces
https://github.com/mikeludemann/error-handling-stack-traces
error error-handling handling javascript parser stack stack-traces trace typescript
Last synced: about 1 year ago
JSON representation
A simple helpful small library to parse and handle the error stack traces
- Host: GitHub
- URL: https://github.com/mikeludemann/error-handling-stack-traces
- Owner: mikeludemann
- License: mit
- Created: 2020-04-06T11:00:16.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-30T20:03:22.000Z (over 3 years ago)
- Last Synced: 2025-03-16T11:05:31.091Z (about 1 year ago)
- Topics: error, error-handling, handling, javascript, parser, stack, stack-traces, trace, typescript
- Language: TypeScript
- Size: 107 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# error-handling-stack-traces
A simple helpful small library to parse and handle the error stack traces
## Information
Supported for different browsers and platforms:
* Firefox
* Chrome
* Edge
* Internet Explorer (IE)
* Node
* ...
## Usage
Install the `errors-handling-stack-traces` package via manager.
Actual we use only `npm`.
```bash
npm install errors-handling-stack-traces
```
Example code:
```js
import { parsingErrorStackTraces } from 'errors-handling-stack-traces';
function foobar() {
throw new Error('fail');
}
try {
foobar();
} catch (error) {
const parsing = parsingErrorStackTraces(error.stack);
console.log(parsing);
} finally {
console.log("End of these code.");
}
// Logs:
// [
// {
// line: 4,
// column: 8,
// type: '',
// name: 'foobar',
// raw: ' at foo (/my-project/foo.ts:4:8)'
// },
// ]
```
### Note:
_The `type` will be the string._
_If the string `"native"`, then native code execution was detected._
## License
MIT
See [the license file](./LICENSE)