# @semantic-release/error

> errors with more than just a message

Latest version **4.0.0** (published 2023-06-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install @semantic-release/error
pnpm add @semantic-release/error
yarn add @semantic-release/error
bun add @semantic-release/error
```

## Health

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

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

Warnings: low downloads.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 4.0.0 |
| Published | 2023-06-07 |
| First published | 2015-07-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/semantic-release__error) |
| Module format | ESM |
| Node | >=18 |
| Dependencies | 0 |
| Unpacked size | 4.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (Unknown) |
| GitHub stars | 12 |
| Author | Stephan Bönnemann |
| Maintainers | travi, pvdlg, semantic-release-bot, gr2m |
| Keywords | error, semantic-release |

## Links

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

## 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

- 4.0.0 (latest) — 2023-06-07
- 3.0.0-beta.1 (beta) — 2021-09-03
- 3.0.0 — 2021-09-17
- 2.2.0 — 2018-02-10
- 2.1.0 — 2017-10-29
- 2.0.1 — 2017-10-29
- 2.0.0 — 2017-09-25
- 1.0.0 — 2015-07-14

## README

# @semantic-release/error

Error type used by all [semantic-release](https://github.com/semantic-release/semantic-release) packages.

[![Build Status](https://github.com/semantic-release/error/workflows/Test/badge.svg)](https://github.com/semantic-release/error/actions?query=workflow%3ATest+branch%3Amaster)

Errors of type `SemanticReleaseError` or an inherited type will be considered by [semantic-release](https://github.com/semantic-release/semantic-release) as an expected exception case (no release to be done, running on a PR etc..). That indicate to the `semantic-release` process to stop and exit with the `0` success code.

Any other type of error will be considered by [semantic-release](https://github.com/semantic-release/semantic-release) as an unexpected error (i/o issue, code problem etc...). That indicate to the `semantic-release` process to stop, log the error and exit with the `1` failure code.

## Usage

```js
import SemanticReleaseError from "@semantic-release/error";

// Default
throw new SemanticReleaseError();

// With error message
throw new SemanticReleaseError("An error happened");

// With error message and error code
throw new SemanticReleaseError("An error happened", "ECODE");

// With error message, error code and details
throw new SemanticReleaseError("An error happened", "ECODE", "Here is some suggestions to solve this error.");

// With inheritance
class InheritedError extends SemanticReleaseError {
  constructor(message, code, newProperty, details) {
    super(message);
    Error.captureStackTrace(this, this.constructor);
    this.name = this.constructor.name;
    this.code = code;
    this.details = details;
    this.newProperty = "newProperty";
  }
}

throw new InheritedError("An error happened", "ECODE", "Here is some suggestions to solve this error.");
```

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