@lvce-editor/verror
Version: 
Improve error messages by adding additional context to an error
33 lines (23 loc) • 552 B
Markdown
Improve error messages by adding additional context to an error.
```sh
npm install @lvce-editor/verror
```
```js
import { VError } from '@lvce-editor/verror'
const otherFunction = () => {
  throw new Error(`oops`)
}
const doSomething = () => {
  try {
    const data = otherFunction()
    return data
  } catch (error) {
    throw new VError(error, `failed to get data`)
  }
}
```
[](https://gitpod.io/#https://github.com/lvce-editor/verror)