@semantic-release/error
Advanced tools
Comparing version 2.1.0 to 2.2.0
module.exports = class SemanticReleaseError extends Error { | ||
constructor(message, code) { | ||
constructor(message, code, details) { | ||
super(message); | ||
Error.captureStackTrace(this, this.constructor); | ||
this.name = this.constructor.name; | ||
this.name = 'SemanticReleaseError'; | ||
this.code = code; | ||
this.details = details; | ||
this.semanticRelease = true; | ||
} | ||
}; |
@@ -1,1 +0,79 @@ | ||
{"name":"@semantic-release/error","description":"errors with more than just a message","version":"2.1.0","author":"Stephan Bönnemann <stephan@boennemann.me> (http://boennemann.me)","bugs":{"url":"https://github.com/semantic-release/error/issues"},"config":{"commitizen":{"path":"cz-conventional-changelog"}},"devDependencies":{"ava":"^0.23.0","codecov":"^3.0.0","commitizen":"^2.9.6","cz-conventional-changelog":"^2.0.0","eslint":"^4.7.0","eslint-config-prettier":"^2.5.0","eslint-config-standard":"^10.2.1","eslint-plugin-import":"^2.7.0","eslint-plugin-node":"^5.1.1","eslint-plugin-prettier":"^2.2.0","eslint-plugin-promise":"^3.5.0","eslint-plugin-standard":"^3.0.1","nyc":"^11.2.1","prettier":"^1.7.0","rimraf":"^2.6.2","semantic-release":"^8.0.0"},"eslintConfig":{"extends":["standard","prettier"],"plugins":["prettier"],"rules":{"prettier/prettier":2}},"files":["index.js"],"homepage":"https://github.com/semantic-release/error#readme","keywords":["error","semantic-release"],"license":"MIT","main":"index.js","nyc":{"include":["index.js"],"reporter":["json","text","html"],"all":true},"prettier":{"printWidth":120,"singleQuote":true,"bracketSpacing":false,"trailingComma":"es5"},"publishConfig":{"access":"public"},"repository":{"type":"git","url":"https://github.com/semantic-release/error.git"},"scripts":{"clean":"rimraf coverage && rimraf .nyc_output","cm":"git-cz","codecov":"codecov -f coverage/coverage-final.json","lint":"eslint .","pretest":"npm run clean && npm run lint","semantic-release":"semantic-release pre && npm publish && semantic-release post","test":"nyc ava -v"}} | ||
{ | ||
"name": "@semantic-release/error", | ||
"description": "errors with more than just a message", | ||
"version": "2.2.0", | ||
"author": "Stephan Bönnemann <stephan@boennemann.me> (http://boennemann.me)", | ||
"bugs": { | ||
"url": "https://github.com/semantic-release/error/issues" | ||
}, | ||
"config": { | ||
"commitizen": { | ||
"path": "cz-conventional-changelog" | ||
} | ||
}, | ||
"devDependencies": { | ||
"ava": "^0.25.0", | ||
"codecov": "^3.0.0", | ||
"commitizen": "^2.9.6", | ||
"cz-conventional-changelog": "^2.0.0", | ||
"eslint-config-prettier": "^2.5.0", | ||
"eslint-plugin-prettier": "^2.2.0", | ||
"nyc": "^11.2.1", | ||
"prettier": "~1.10.0", | ||
"semantic-release": "^12.2.2", | ||
"xo": "^0.18.2" | ||
}, | ||
"files": [ | ||
"index.js" | ||
], | ||
"homepage": "https://github.com/semantic-release/error#readme", | ||
"keywords": [ | ||
"error", | ||
"semantic-release" | ||
], | ||
"license": "MIT", | ||
"main": "index.js", | ||
"nyc": { | ||
"include": [ | ||
"index.js" | ||
], | ||
"reporter": [ | ||
"json", | ||
"text", | ||
"html" | ||
], | ||
"all": true | ||
}, | ||
"prettier": { | ||
"printWidth": 120, | ||
"singleQuote": true, | ||
"bracketSpacing": false, | ||
"trailingComma": "es5" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/semantic-release/error.git" | ||
}, | ||
"scripts": { | ||
"cm": "git-cz", | ||
"codecov": "codecov -f coverage/coverage-final.json", | ||
"lint": "xo", | ||
"pretest": "npm run lint", | ||
"semantic-release": "semantic-release", | ||
"test": "nyc ava -v" | ||
}, | ||
"xo": { | ||
"extends": [ | ||
"prettier" | ||
], | ||
"plugins": [ | ||
"prettier" | ||
], | ||
"rules": { | ||
"prettier/prettier": 2 | ||
} | ||
} | ||
} |
@@ -5,2 +5,6 @@ # @semantic-release/error | ||
[![Travis](https://img.shields.io/travis/semantic-release/error.svg)](https://travis-ci.org/semantic-release/error) | ||
[![Codecov](https://img.shields.io/codecov/c/github/semantic-release/error.svg)](https://codecov.io/gh/semantic-release/error) | ||
[![Greenkeeper badge](https://badges.greenkeeper.io/semantic-release/error.svg)](https://greenkeeper.io) | ||
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. | ||
@@ -10,12 +14,2 @@ | ||
[![npm](https://img.shields.io/npm/v/@semantic-release/error.svg)](https://www.npmjs.com/package/@semantic-release/error) | ||
[![Greenkeeper badge](https://badges.greenkeeper.io/semantic-release/error.svg)](https://greenkeeper.io/) | ||
[![license](https://img.shields.io/github/license/semantic-release/error.svg)](https://github.com/semantic-release/error/blob/master/LICENSE) | ||
[![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier) | ||
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release) | ||
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/) | ||
[![Travis](https://img.shields.io/travis/semantic-release/error.svg)](https://travis-ci.org/semantic-release/error) | ||
[![Codecov](https://img.shields.io/codecov/c/github/semantic-release/error.svg)](https://codecov.io/gh/semantic-release/error) | ||
## Usage | ||
@@ -35,5 +29,8 @@ | ||
// 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) { | ||
constructor(message, code, newProperty, details) { | ||
super(message); | ||
@@ -43,2 +40,3 @@ Error.captureStackTrace(this, this.constructor); | ||
this.code = code; | ||
this.details = details; | ||
this.newProperty = 'newProperty'; | ||
@@ -48,3 +46,3 @@ } | ||
throw new InheritedError('An error happened', 'ECODE'); | ||
throw new InheritedError('An error happened', 'ECODE', 'Here is some suggestions to solve this error.'); | ||
``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
10
10
5038
44