Gathering detailed insights and metrics for custom-verror
Gathering detailed insights and metrics for custom-verror
Gathering detailed insights and metrics for custom-verror
Gathering detailed insights and metrics for custom-verror
npm install custom-verror
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
1 Stars
10 Commits
42 Watching
2 Branches
50 Contributors
Updated on 10 Mar 2020
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
-86%
8
Compared to previous day
Last week
-3.5%
246
Compared to previous week
Last month
42.6%
1,144
Compared to previous month
Last year
-35.2%
8,200
Compared to previous year
1
4
Simple class extending VError for easy custom error creation.
Here is the basic usage. For more use cases, see the tests.
UserNotAllowedError.js
1'use strict'; 2 3const CustomVError = require('custom-verror'); 4 5// Replace UserNotAllowedError with your custom error name 6module.exports = class UserNotAllowedError extends CustomVError { 7 constructor(...args) { 8 super(...args); 9 // Provide a default message 10 this.message = this.message || 'User is not allowed to perform this action'; 11 } 12};
1const UserNotAllowedError = require('./UserNotAllowedError');
2
3function performAction() {
4 if (!isAllowed) {
5 throw new UserNotAllowedError({
6 // You can provide some error metadata. This will be appended to the message
7 info: {
8 user_id: user._id
9 }
10 })
11 }
12}
1try { 2 performAction(); 3} catch (ex) { 4 if (ex instanceof UserNotAllowedError) { 5 numberOfTimesUsersTriedToDoSomethingTheyWerentSupposedTo++; 6 // This will log the default message and the metadata in following format: 7 // "User is not allowed to perform this action user_id=FOO" 8 console.log(ex); 9 } 10}
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
Found 1/9 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
Reason
project is not fuzzed
Details
Reason
license file not detected
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2024-11-18
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