https://github.com/staab/succinct-async
A tiny library to help you locate errors in heavily asynchronous javascript code, with no noise.
https://github.com/staab/succinct-async
Last synced: 7 months ago
JSON representation
A tiny library to help you locate errors in heavily asynchronous javascript code, with no noise.
- Host: GitHub
- URL: https://github.com/staab/succinct-async
- Owner: staab
- Created: 2019-08-06T19:47:42.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-08-06T22:38:52.000Z (almost 7 years ago)
- Last Synced: 2024-12-29T08:43:30.982Z (over 1 year ago)
- Language: JavaScript
- Size: 7.81 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
This is a tiny library for adding custom trace data to error objects for easier debugging. Read the [blog post]().
[](https://badge.fury.io/js/succinct-async)
Example:
```js
class Thing {
something() {
throw new Error("Oops")
}
async somethingElse(cb) {
this.something(await fetch('/'))
}
}
instrumentObject(Thing.prototype)
const doStuff = instrument('doStuff', async () => {
const thing = new Thing()
await thing.somethingElse()
})
doStuff()
/*
Uncaught (in promise) Error: Oops
at Thing.something (:3:11)
at Thing.wrapper (:11:18)
at Thing.somethingElse (:6:10)
at async :15:3
Intercepted in:
Thing.something
Thing.somethingElse
doStuff
*/
```