Skip to content

onesy-me/errors

Repository files navigation



onesy logo

onesy Errors

Errors


MIT license     Production ready     UMD 0.8kb gzipped     100% test cov     Browser and Nodejs

Very simple code     Modern code     Junior friendly     Typescript     Made with 💛


Getting started

Add

yarn add @onesy/errors

Use

  import { OnesyError } from '@onesy/errors';
  import OnesyLog from '@onesy/log';

  const onesyError = new OnesyError('a');

  onesyError.name;
  onesyError.message;
  onesyError.added_at;
  onesyError.stack;

  // OnesyError
  // 'a'
  // 1643893234
  // 'OnesyError: a\n    at eval (eval at evaluate (:3:2389), <anonymous>:2:31)\n    at t.default.evaluate (<anonymous>:3:2412)\n    at t.default.<anonymous> (<anonymous>:1:44)'

  OnesyLog.error(onesyError);

  // Output

    // 04-04-2014 04:04:14.141 (error):

    // a

    // OnesyError: a
    //    at eval (eval at evaluate (:3:2389), <anonymous>:2:31)
    //    at t.default.evaluate (<anonymous>:3:2412)
    //    at t.default.<anonymous> (<anonymous>:1:44)

Dev

Install

yarn

Test

yarn test

Prod

Build

yarn build