# terrs

> A JavaScript errors library

Latest version **0.1.2** (published 2019-03-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install terrs
pnpm add terrs
yarn add terrs
bun add terrs
```

## Health

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

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

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2019-03-18 |
| First published | 2019-03-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=10.0.0 |
| Dependencies | 0 |
| Unpacked size | 8.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | towyuan |
| Keywords | error, cause, reason, nested |

## Links

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

## Alternatives

- [@sentry/react-native](https://npm.io/package/@sentry/react-native.md) — 2.6M weekly downloads
- [@ardatan/aggregate-error](https://npm.io/package/@ardatan/aggregate-error.md) — 708.1K weekly downloads
- [custom-error-generator](https://npm.io/package/custom-error-generator.md) — 2.0K weekly downloads
- [@technik-sde/prosemirror-recreate-transform](https://npm.io/package/@technik-sde/prosemirror-recreate-transform.md) — 1.5K weekly downloads
- [@suchipi/error-utils](https://npm.io/package/@suchipi/error-utils.md) — 78 weekly downloads

## Recent versions

- 0.1.2 (latest) — 2019-03-18
- 0.1.1 — 2019-03-18
- 0.1.0 — 2019-03-01

## README

# terrs

> A JavaScript errors library

## Installation

```bash
$ npm i terrs
```

## Usage

```js
const {TError} = require("terrs");

const error =  TError.create('The main error', new Error('The nested error'));

console.log(error);
/*  => 
    1 |"use strict";
    2 |Object.defineProperty(exports, "__esModule", { value: true });
    3 |class TError extends Error {
    4 |    static create(message, cause) {
 >  5 |        return new TError(message, cause);
    6 |    }
    7 |    constructor(message, cause) {
    8 |        if (message instanceof Error) {
    9 |            cause = message;
   10 |            message = "";

   at Function.create ([...]/terrs/lib/terror.js:5:16)
   at Object.<anonymous> ([...]/terrs/examples/example.js:3:22)
   at Module._compile (internal/modules/cjs/loader.js:689:30)
   at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
   at Module.load (internal/modules/cjs/loader.js:599:32)
   at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
   at Function.Module._load (internal/modules/cjs/loader.js:530:3)
   at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
   at startup (internal/bootstrap/node.js:283:19)
   at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)
   at Object.<anonymous> ([...]/terrs/examples/example.js:3:47)
   at Module._compile (internal/modules/cjs/loader.js:689:30)
   at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
   at Module.load (internal/modules/cjs/loader.js:599:32)
   at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
   at Function.Module._load (internal/modules/cjs/loader.js:530:3)
   at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
   at startup (internal/bootstrap/node.js:283:19)
   at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)
 */

throw error;
/* =>
TError: The main error
    at Function.create ([...]/terrs/lib/terror.js:5:16)
    at Object.<anonymous> ([...]/terrs/examples/example.js:3:22)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)
Caused By: Error: The nested error
    at Object.<anonymous> ([...]/terrs/examples/example.js:3:47)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)
 */
```

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