# run-time-error-cjs

> A better error that is inspired by the Java exception that is also serializable to JSON.

Latest version **1.4.0** (published 2023-10-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install run-time-error-cjs
pnpm add run-time-error-cjs
yarn add run-time-error-cjs
bun add run-time-error-cjs
```

## Health

**Score 40/100 (D)** — status: abandoned.

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

Warnings: low downloads.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.4.0 |
| Published | 2023-10-27 |
| First published | 2023-10-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=12.0.0 |
| Dependencies | 0 |
| Unpacked size | 16.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Luke Phillips |
| Maintainers | petermetz |
| Keywords | error, serializable, json, exception |

## Links

- npm: https://www.npmjs.com/package/run-time-error-cjs
- Repository: https://github.com/lsphillips/RuntimeError
- Issues: https://github.com/lsphillips/RuntimeError/issues
- npm.io page: https://npm.io/package/run-time-error-cjs

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.4.0 (latest) — 2023-10-27

## README

# RuntimeError

[![Available from NPM](https://img.shields.io/npm/v/run-time-error.svg?maxAge=900)](https://www.npmjs.com/package/run-time-error)
[![Built using GitHub Action](https://github.com/lsphillips/RuntimeError/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/lsphillips/RuntimeError/actions)

A better error that is inspired by the Java exception that is also serializable to JSON.

## Usage

``` js
import { RuntimeError } from 'run-time-error';

try
{
  throw new Error('The root cause error.');
}
catch (cause)
{
  throw new RuntimeError('An unexpected error occurred while performing an operation.', cause);
}
```

This module can also be treated as a CommonJS module:

``` js
const { RuntimeError } = require('run-time-error');
```

## Getting started

This project is available through the Node Package Manager (NPM), so you can install it like so:

``` sh
npm install run-time-error
```

**Please Note:** Versions of Node lower than **v12.0.0** are not supported.

## Development

### Building

You can build UMD and ESM versions of this module that are minified:

``` sh
npm run build
```

### Testing

This module also has a robust test suite:

``` sh
npm test
```

This also runs code quality checks using ESLint. Please refer to the `.eslintrc` files to familiar yourself with the rules.

## License

This project is released under the MIT license.

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