An open API service indexing awesome lists of open source software.

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.

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]().

[![npm version](https://badge.fury.io/js/succinct-async.svg)](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
*/
```