# babel-errors

> Nicer error messages for Babel

Latest version **1.1.1** (published 2017-05-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install babel-errors
pnpm add babel-errors
yarn add babel-errors
bun add babel-errors
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2017-05-29 |
| First published | 2017-05-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | James Kyle |
| Maintainers | thejameskyle |

## Links

- npm: https://www.npmjs.com/package/babel-errors
- npm.io page: https://npm.io/package/babel-errors

## Recent versions

- 1.1.1 (latest) — 2017-05-29
- 1.1.0 — 2017-05-27
- 1.0.1 — 2017-05-25
- 1.0.0 — 2017-05-17

## README

# babel-errors

> Nicer error messages for Babel

```js
import createBabelFile from 'babel-file';
import {BabelError, prettyError, buildCodeFrameError} from 'babel-errors';

const file = createBabelFile(...);

let path = file.path;
let {line, column} = path.loc.start;

throw prettyError(createErrorWithLoc('Error at this position', line, column));
throw buildCodeFrameError(path, 'Error with this Path');
```

### `createErrorWithLoc(message, line, column)`

This lets you add location information to your errors.

### `wrapErrorWithCodeFrame(err)`

You can use this when capturing errors thrown by Babel or constructed using
`createErrorWithLoc` to add a code frame when possible.

### `buildCodeFrameError(path, message)`

You can use this to build a code frame error around a path with a specified
message.

Use this instead of `path.buildCodeFrameError` when you aren't running inside a
Babel plugin.

### `toErrorStack(error)`

Creates string with error name, message, stack/code frame.

---
_Source: https://npm.io/package/babel-errors · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
