1.0.0 • Published 6 years ago

bthis-handle-it-lite v1.0.0

Weekly downloads
4
License
MIT
Repository
github
Last release
6 years ago

handle-it-lite ( error handling package )

A simple error catching an handling application. On error application will log an save in a error-log folder, error messages formatted in the date and time of error.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

For development environment only

Prerequisites

What dependences you need to install the software and how to install them as followed for MacOS

  1. NodeJS - As an asynchronous event driven JavaScript runtime, Node is designed to build scalable network applications.
  2. Npm - npm makes it easy for JavaScript developers to share and reuse code, and makes it easy to update the code that you’re sharing, so you can build amazing things.
  3. Homebrew - Homebrew installs packages to their own directory and then symlinks their files into /usr/local.
  • Recommended install with brew.
    • past the following into your Terminal
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Install nodeJS & npm with brew : past the following into your terminal

$ brew install node
  • After install is complete check install using the following in your terminal.
    For node - node -v this will print out a version number like this v10.6.0.
    Now do the same for npm as followed npm -v output will look something like this 6.2.0.

To learn more please visit - node & npm install.


Installing

A step by step series of examples that tell you how to get a development env running
1. Step one
In your project root dir ('./') use the following command in your terminal.

$ npm i bthis-handle-it-lite --save-dev

End with an example of getting some data out of the system or using it for a little demo .

Example of usage.

  1. Example One.
var handleErr = require('handle-it-lite');

var error = handleErr.error('User defined error message.', errStack);

console.error(error);
// === Output === //
// User defined error message. Please check error logs for more details, "./error-logs/MM-DD-YYYY.log"
  1. Example Two.
var handleErr = require('handle-it-lite');

var error = (errorMessage, errStack) => {
  return handleErr.error(errorMessage, errStack);
}

console.error(error('User defined error message.', errStack));
// === Output === //
// User defined error message. Please check error logs for more details, "./error-logs/MM-DD-YYYY.log"
  1. Example three.
const handleIt = require('./handle-it');

var err = {
  readWrite: 'File corrupt or unable to save file.',
  notFound: 404 + ' Not Found.',
  standard: 'Error :  please see log file.'
};
var error = ((errMessage, stackTrace) => {
      return handleIt.error(errMessage, stackTrace);
});

error(err.notFound, 'stackTrace');
// === Output === //
// 404 Not Found. --> Please check error logs for more details, "./error-logs/7-17-2018.log"

Syntax

OptionDescription
errMessageString
errStackDefault error stack || String

All error messages will be logged in project root dir ('./') called 'error-logs/mm-dd-yyyy.log'
Full path will look like : './error-logs/7-20/2018.log'


Deployment

This product is for development testing only.


Built With

NodeJS - An asynchronous event driven JavaScript runtime, Node is designed to build scalable network applications.

FS - Node.js as a File Server. The Node.js file system module allows you to work with the file system on your computer.


Authors


License

MIT

This project is licensed under the MIT License - see the LICENSE.md file for details.
Yay Free software!