@alvitrjs/util v1.0.0
In need of something util? maybe you will find here!
A utility package
Getting Started
Prerequisites
- NodeJS : >= 10.16.1
- NPM : >= 6.9.0
On Windows go to NodeJS and download the LTS version, execute and that is it!
On Ubuntu you can install via NodeSource:
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt install nodejs
On MacOS you can install via brew:
brew install node
Or you can go to NodeJS and download the LTS version, execute and that is it!
Instalation
You can use NPM or Yarn to install Util
npm i --save @alvitrjs/util
yarn add @alvitrjs/util
Table of Contents
Exception
A utility exception class that helps by adding a bit more information about your error!
import Exception from '@alvitrjs/util/Exception';
throw new Exception("Custom Exception Error", 500, "CUSTOM_EXCEPTION");
// This will throw an exception like:
// Exception: CUSTOM_EXCEPTION : Custom Exception Error
Extending Exception
You can extend the Exception class if you want to create custom errors.
import Exception from '@alvitrjs/util/Exception';
class CustomException extends Exception {
static enum CODES {
ERR_NOT_FOUND = "ERR_NOT_FOUND"
}
}
throw new CustomException("File not found", 500, CustomException.CODES.ERR_NOT_FOUND);
// This will throw an exception like:
// CustomException: ERR_NOT_FOUND : File not found
How to Contribute
We at AlvitrJS would LOVE for you to contribute for our projects, we think that the more the merrier.
Please read our contribution guide lines for details on our code of conduct, and the process for submitting pull requests and issues to us.
In development
There isn't anything yet! want something to be added that you think it may be good or needed? send us a new feature issue!
Authors
- Gustavo Fenilli - Owner - Gustavo Fenilli
You should also check the list of all the nice contributors who participated in this project.
Versions
6 years ago