Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@darkwolf/code-error

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@darkwolf/code-error - npm Package Compare versions

Comparing version 2.1.0 to 6.6.6

src/index.js

15

package.json
{
"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)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc