Installations
npm install makeerror
Developer Guide
Typescript
No
Module System
CommonJS
Node Version
16.11.1
NPM Version
8.1.0
Score
99.8
Supply Chain
90.7
Quality
75.7
Maintenance
100
Vulnerability
100
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Developer
daaku
Download Statistics
Total Downloads
4,114,995,631
Last Day
2,679,098
Last Week
20,440,501
Last Month
96,214,936
Last Year
1,095,647,493
GitHub Statistics
12 Stars
22 Commits
4 Forks
4 Watching
1 Branches
2 Contributors
Package Meta Information
Latest Version
1.0.12
Package Id
makeerror@1.0.12
Size
2.51 kB
NPM Version
8.1.0
Node Version
16.11.1
Publised On
23 Oct 2021
Total Downloads
Cumulative downloads
Total Downloads
4,114,995,631
Last day
-34.9%
2,679,098
Compared to previous day
Last week
-9.9%
20,440,501
Compared to previous week
Last month
-7.4%
96,214,936
Compared to previous month
Last year
12.2%
1,095,647,493
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
makeerror
A library to make errors.
Basics
Makes an Error constructor function with the signature below. All arguments are
optional, and if the first argument is not a String
, it will be assumed to be
data
:
1function(message, data)
You'll typically do something like:
1var makeError = require('makeerror') 2var UnknownFileTypeError = makeError( 3 'UnknownFileTypeError', 4 'The specified type is not known.' 5) 6var er = UnknownFileTypeError()
er
will have a prototype chain that ensures:
1er instanceof UnknownFileTypeError 2er instanceof Error
Templatized Error Messages
There is support for simple string substitutions like:
1var makeError = require('makeerror') 2var UnknownFileTypeError = makeError( 3 'UnknownFileTypeError', 4 'The specified type "{type}" is not known.' 5) 6var er = UnknownFileTypeError({ type: 'bmp' })
Now er.message
or er.toString()
will return 'The specified type "bmp" is not known.'
.
Prototype Hierarchies
You can create simple hierarchies as well using the prototype
chain:
1var makeError = require('makeerror') 2var ParentError = makeError('ParentError') 3var ChildError = makeError( 4 'ChildError', 5 'The child error.', 6 { proto: ParentError() } 7) 8var er = ChildError()
er
will have a prototype chain that ensures:
1er instanceof ChildError 2er instanceof ParentError 3er instanceof Error
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
- Info: project has a license file: license:0
- Warn: project license file does not contain an FSF or OSI license.
Reason
Found 2/22 approved changesets -- score normalized to 0
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 2 are checked with a SAST tool
Score
3
/10
Last Scanned on 2024-12-16
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