Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gitsindonesia/common-js
https://github.com/gitsindonesia/common-js
Last synced: about 23 hours ago
JSON representation
- Host: GitHub
- URL: https://github.com/gitsindonesia/common-js
- Owner: gitsindonesia
- Created: 2022-02-10T03:27:35.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-02-25T08:08:09.000Z (almost 3 years ago)
- Last Synced: 2024-11-11T09:14:59.985Z (about 2 months ago)
- Language: TypeScript
- Size: 67.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Common JS
Common Library from Gits Indonesia. Purpose to implement reusable code.
## Current Features
- throw Error for HTTP
## Usage
```javascript
try{
throw new ErrorHTTP(400, "Bad request");
}catch (error){
console.error(error)
}
```
```javascript
try{
throw new ErrorHTTPBadRequest("Validation Error");
}catch (error){
console.error(error)
}
```Other error exception can be used:
- ErrorHTTPUnauthorized
- ErrorHTTPForbidden
- ErrorHTTPNotFound
- ErrorHTTPServerError
- ErrorHTTPBadGateway