Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/gitsindonesia/common-js


https://github.com/gitsindonesia/common-js

Last synced: about 23 hours ago
JSON representation

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