@semantic-release/error
errors with more than just a message
Last updated 2 years ago by semantic-release-bot .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @semantic-release/error 
SYNC missed versions from official npm registry.

@semantic-release/error

Error type used by all semantic-release packages.

Travis Codecov Greenkeeper badge

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

const SemanticReleaseError = require('@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.');

Current Tags

  • 2.2.0                                ...           latest (2 years ago)

5 Versions

  • 2.2.0                                ...           2 years ago
  • 2.1.0                                ...           3 years ago
  • 2.0.1                                ...           3 years ago
  • 2.0.0                                ...           3 years ago
  • 1.0.0                                ...           5 years ago
Downloads
Today 2
This Week 215
This Month 1,491
Last Day 103
Last Week 879
Last Month 2,703
Dependencies (0)
None
Dev Dependencies (10)
Dependents (155)

Copyright 2014 - 2016 © taobao.org |