Installations
npm install make-error
Developer Guide
Typescript
No
Module System
CommonJS
Node Version
8.17.0
NPM Version
6.13.4
Score
98.2
Supply Chain
100
Quality
79.8
Maintenance
100
Vulnerability
100
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Developer
JsCommunity
Download Statistics
Total Downloads
4,041,253,893
Last Day
871,639
Last Week
11,684,191
Last Month
90,678,892
Last Year
1,200,462,680
GitHub Statistics
69 Stars
102 Commits
14 Forks
5 Watching
19 Branches
9 Contributors
Bundle Size
1.53 kB
Minified
648.00 B
Minified + Gzipped
Package Meta Information
Latest Version
1.3.6
Package Id
make-error@1.3.6
Size
4.33 kB
NPM Version
6.13.4
Node Version
8.17.0
Publised On
19 Feb 2020
Total Downloads
Cumulative downloads
Total Downloads
4,041,253,893
Last day
-13.4%
871,639
Compared to previous day
Last week
-50.1%
11,684,191
Compared to previous week
Last month
-23.7%
90,678,892
Compared to previous month
Last year
25.4%
1,200,462,680
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
make-error
Make your own error types!
Features
- Compatible Node & browsers
instanceof
supporterror.name
&error.stack
support- compatible with CSP (i.e. no
eval()
)
Installation
Node & Browserify/Webpack
Installation of the npm package:
> npm install --save make-error
Then require the package:
1var makeError = require("make-error");
Browser
You can directly use the build provided at unpkg.com:
1<script src="https://unpkg.com/make-error@1/dist/make-error.js"></script>
Usage
Basic named error
1var CustomError = makeError("CustomError"); 2 3// Parameters are forwarded to the super class (here Error). 4throw new CustomError("a message");
Advanced error class
1function CustomError(customValue) { 2 CustomError.super.call(this, "custom error message"); 3 4 this.customValue = customValue; 5} 6makeError(CustomError); 7 8// Feel free to extend the prototype. 9CustomError.prototype.myMethod = function CustomError$myMethod() { 10 console.log("CustomError.myMethod (%s, %s)", this.code, this.message); 11}; 12 13//----- 14 15try { 16 throw new CustomError(42); 17} catch (error) { 18 error.myMethod(); 19}
Specialized error
1var SpecializedError = makeError("SpecializedError", CustomError); 2 3throw new SpecializedError(42);
Inheritance
Best for ES2015+.
1import { BaseError } from "make-error"; 2 3class CustomError extends BaseError { 4 constructor() { 5 super("custom error message"); 6 } 7}
Related
- make-error-cause: Make your own error types, with a cause!
Contributions
Contributions are very welcomed, either on the documentation or on the code.
You may:
- report any issue you've encountered;
- fork and create a pull request.
License
ISC © Julien Fontanet
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: ISC License: LICENSE:0
Reason
Found 3/30 approved changesets -- score normalized to 1
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 3 are checked with a SAST tool
Reason
37 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92
- Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-x9w5-v3q2-3rhw
- Warn: Project is vulnerable to: GHSA-wg6g-ppvx-927h
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c
- Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq
- Warn: Project is vulnerable to: GHSA-r9p9-mrjm-926w
- Warn: Project is vulnerable to: GHSA-434g-2637-qmqr
- Warn: Project is vulnerable to: GHSA-49q7-c7j4-3p7m
- Warn: Project is vulnerable to: GHSA-977x-g7h5-7qgw
- Warn: Project is vulnerable to: GHSA-f7q4-pwc6-w24p
- Warn: Project is vulnerable to: GHSA-fc9h-whq2-v747
- Warn: Project is vulnerable to: GHSA-ww39-953v-wcq6
- Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj
- Warn: Project is vulnerable to: GHSA-896r-f27r-55mw
- Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h
- Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9
- Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h
- Warn: Project is vulnerable to: GHSA-5fw9-fq32-wv5p
- Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9
- Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp
- Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-44c6-4v22-4mhx
- Warn: Project is vulnerable to: GHSA-4x5v-gmq8-25ch
- Warn: Project is vulnerable to: GHSA-g4rg-993r-mgx7
- Warn: Project is vulnerable to: GHSA-jgrx-mgxx-jf9v
- Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3
- Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7
- Warn: Project is vulnerable to: GHSA-6fc8-4gx4-v693
- Warn: Project is vulnerable to: GHSA-3h5v-q93c-6h6q
- Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh
Score
1.9
/10
Last Scanned on 2024-12-23
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More