1. @semantic-release/error
errors with more than just a message
@semantic-release/error
Package: @semantic-release/error
Created by: semantic-release
Last modified: Wed, 12 Jul 2023 04:06:55 GMT
Version: 4.0.0
License: MIT
Downloads: 9,975,200
Repository: https://github.com/semantic-release/error

Install

npm install @semantic-release/error
yarn add @semantic-release/error

@semantic-release/error

Error type used by all semantic-release packages.

Build Status

Errors of type SemanticReleaseError or an inherited type will be considered by 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 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

 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.");

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code