0.3.3 • Published 5 years ago

@gourmet/promise-main v0.3.3

Weekly downloads
5
License
MIT
Repository
github
Last release
5 years ago

@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());