# @marvinh/locateable-error

> Print nice debug traces

Latest version **1.2.1** (published 2018-02-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install @marvinh/locateable-error
pnpm add @marvinh/locateable-error
yarn add @marvinh/locateable-error
bun add @marvinh/locateable-error
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.1 |
| Published | 2018-02-11 |
| First published | 2018-02-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 160.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Marvin Hagemeister |
| Maintainers | marvinhagemeister |

## Links

- npm: https://www.npmjs.com/package/@marvinh/locateable-error
- Repository: https://github.com/marvinhagemeister/locateable-error
- Homepage: https://github.com/marvinhagemeister/locateable-error#readme
- Issues: https://github.com/marvinhagemeister/locateable-error/issues
- npm.io page: https://npm.io/package/@marvinh/locateable-error

## Dependencies (2)

- [chalk](https://npm.io/package/chalk.md) ^2.3.0
- [@babel/code-frame](https://npm.io/package/@babel/code-frame.md) ^7.0.0-beta.39

## Recent versions

- 1.2.1 (latest) — 2018-02-11
- 1.2.0 — 2018-02-11
- 1.1.0 — 2018-02-10
- 1.0.0 — 2018-02-10

## README

# Locateable Error

Display a nicely formatted excerpt of the location where an `Error` occured.
Works with single pointers or ranges.

![Locateable Error](./example.png)

## Installation

```bash
npm install @marvinh/locateable-error

# or with yarn
yarn add @marvinh/locateable-error
```

## Usage

All objects which should produce nice coder-exerpts must implement the
`Locateable` interface:

```ts
interface Locateable {
  message: string;
  source: { body: string; name: string };
  inlineMessage?: string;
  locations: Array<{ line: number; column: number }>;
}
```

and then call `formatLocateable` on your object:

```ts
import { formatLocateable, Locateable } from "@marvinh/locateable-error";

// Your object which implements the `Locateable` interface
const err: Locateable = {...}

// Get the formatted string
const out = formatLocateable(err);

console.log(out);
// Prints
// > 1 | foo asd
//     |  ^^^ fail
//   2 | asd ads
//   3 | asd"
```

## License

`MIT`, see [License file](./LICENSE.md)

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