@darkwolf/code-error
Advanced tools
Comparing version 2.1.0 to 6.6.6
{ | ||
"name": "@darkwolf/code-error", | ||
"version": "2.1.0", | ||
"description": "Code Error Utility", | ||
"main": "index.js", | ||
"version": "6.6.6", | ||
"description": "Code Error", | ||
"main": "src/index.js", | ||
"scripts": { | ||
@@ -15,5 +15,3 @@ "test": "echo \"Error: no test specified\" && exit 1" | ||
"code", | ||
"error", | ||
"utility", | ||
"utils" | ||
"error" | ||
], | ||
@@ -25,6 +23,3 @@ "author": "Pavel Wolf", | ||
}, | ||
"homepage": "https://github.com/darkwolf/code-error#readme", | ||
"dependencies": { | ||
"@darkwolf/validator": "^2.1.6" | ||
} | ||
"homepage": "https://github.com/darkwolf/code-error#readme" | ||
} |
@@ -1,2 +0,2 @@ | ||
# Code Error Utility | ||
# Code Error | ||
## Install | ||
@@ -6,23 +6,2 @@ ```sh | ||
``` | ||
## Concept | ||
#### Everything is an object! | ||
#### There are only properties and arguments! | ||
#### Custom error class instances must be called a namespace using PascalCase and end with 'Error' (ex. CustomNamespaceError) | ||
#### Use kebab-case to name namespaces, codes, and error types | ||
#### Use the following types for error types: | ||
###### property-required | ||
###### invalid-property-type | ||
###### invalid-property-value | ||
###### unknown-property | ||
###### property-return-invalid-type | ||
###### property-return-invalid-value | ||
###### argument-required | ||
###### invalid-argument-type | ||
###### invalid-argument-value | ||
###### unknown-argument | ||
###### argument-return-invalid-type | ||
###### argument-return-invalid-value | ||
#### Pass state to error instance | ||
#### Use a directory called 'utils' to store custom error class instances, errors and validators | ||
#### Following this concept, we can easily handle errors exceptions dynamically | ||
## Usage | ||
@@ -36,2 +15,3 @@ ```javascript | ||
this.namespace = 'darkwolf' | ||
this.name = 'DarkwolfError' | ||
} | ||
@@ -49,3 +29,2 @@ } | ||
case 'invalid-darkwolf-id': { | ||
doSmth() | ||
break | ||
@@ -60,11 +39,4 @@ } | ||
} | ||
``` | ||
## Init | ||
### new CodeError(params[namespace, code, type, message, state] || ...[code, message]) | ||
## Methods | ||
### setNamespace(namespace) | ||
### setCode(code) | ||
### setType(type) | ||
### setMessage(message) | ||
### setState(newState || callback(state => newState)) | ||
### new CodeError(code, message) |
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
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
0
2782
14
39
- Removed@darkwolf/validator@^2.1.6
- Removed@darkwolf/validator@2.2.1(transitive)