mirror of
https://github.com/danbulant/bpm
synced 2026-06-18 22:11:19 +00:00
Add exception handling
This commit is contained in:
parent
94ed56ba75
commit
d2a1c18e8a
1 changed files with 12 additions and 5 deletions
17
index.js
17
index.js
|
|
@ -5,22 +5,29 @@ var console = new Console;
|
|||
var pkg = new Package;
|
||||
const VERSION = "0.1"
|
||||
|
||||
process.on('uncaughtException', function (err) {
|
||||
console.error("Uncaught exception:", err.message);
|
||||
console.error(err.stack);
|
||||
});
|
||||
|
||||
process.on('unhandledRejection', function (reason, p) {
|
||||
console.warn("Possibly Unhandled Rejection, reason: ", reason);
|
||||
});
|
||||
|
||||
if(!args.contents[0]){
|
||||
return console.output(`BPM v${VERSION}\nMade by Daniel Bulant`);
|
||||
}
|
||||
|
||||
switch(args.contents[0]){
|
||||
case "i":
|
||||
case "install":
|
||||
console.warn("To be done");
|
||||
break;
|
||||
case "get":
|
||||
case "info":
|
||||
pkg.get(args.contents[1]).then(console.log);
|
||||
pkg.get(args.contents[1]).catch(console.error);
|
||||
break;
|
||||
case "bin":
|
||||
console.log(__dirname);
|
||||
break;
|
||||
case "i":
|
||||
case "install":
|
||||
case "ls":
|
||||
case "help":
|
||||
case "ping":
|
||||
|
|
|
|||
Loading…
Reference in a new issue