@gourmet/promise-main

0.3.3 • Public • Published

@gourmet/promise-main

Handles the top main promise of a console app.

Why?

Because all errors should be propagated properly to the top main promise and there must be only one error handler in a console app.

Basic usage

const promiseMain = require("@gourmet/promise-main");

function main() {
  // ... main function of a console app that returns a promise ...
}

// Instead of this
/*
main().catch(err => {
  console.error(err);
  process.exit(1);
});
*/

// Do this
promiseMain(main());

Readme

Keywords

none

Package Sidebar

Install

npm i @gourmet/promise-main

Weekly Downloads

0

Version

0.3.3

License

MIT

Unpacked Size

2.7 kB

Total Files

5

Last publish

Collaborators

  • gourmet