Hellrazor.js
Create custom errors for your JavaScript projects
Installation
1- in browser:
2- via NPM:
npm install hellrazor
Usage
You'll use createError()
method to create an error, it takes two strings as parameters for Error Name
& Error Message
and will return the new error Function
// if you have commonjs in your project// if not skip this linevar Hellrazor = ; // The below is the same in any JavaScript environment (Browser or Node.js)var e = Hellrazor; try // you can re-assign the message if you want throw "new message";catch err console; // erropac console; // new message console; console; // true console; // true
Extra
You can extra objects to the custom error using prototype
, for example the time when the error occurred
var e = Hellrazor;try eprototypehappenAt = ; throw ;catch err console;
License
This project is under the MIT license.