Skip to content
/ e Public

Better error, Make errors easier to extend, structure.

Notifications You must be signed in to change notification settings

mosteast/e

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Better error

Project Information

  • Main problem this package solves: Make errors easier to extend, structure.
  • Main language: Typescript.

Getting started

class My_error extends E {
  message = "Default message";
  eid = "E123";

  constructor(...argS) {
    super();
    this.init(...argS);
  }
}

// Use default message
throw new My_error(); // My_error: Default message

// Custom message
throw new My_error("Invalid configuration"); // My_error: Invalid configuration

// Error message with solution
throw new My_error("Invalid configuration", "Configure .env file first"); // My_error: Invalid  configuration

// Error with more information
throw new My_error({
  message: "Invalid configuration",
  solution: "Configure .env file first",
  eid: "E456",
  level: "internal",
});
npm i # Install.
npm t # Run test first.
npm start # Start development.

{Can do this}

{Example}

{Can do that}

{Example}

About

Better error, Make errors easier to extend, structure.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published