mirror of
https://github.com/danbulant/bpm
synced 2026-07-05 11:00:40 +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;
|
var pkg = new Package;
|
||||||
const VERSION = "0.1"
|
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]){
|
if(!args.contents[0]){
|
||||||
return console.output(`BPM v${VERSION}\nMade by Daniel Bulant`);
|
return console.output(`BPM v${VERSION}\nMade by Daniel Bulant`);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(args.contents[0]){
|
switch(args.contents[0]){
|
||||||
case "i":
|
|
||||||
case "install":
|
|
||||||
console.warn("To be done");
|
|
||||||
break;
|
|
||||||
case "get":
|
case "get":
|
||||||
case "info":
|
case "info":
|
||||||
pkg.get(args.contents[1]).then(console.log);
|
pkg.get(args.contents[1]).catch(console.error);
|
||||||
break;
|
break;
|
||||||
case "bin":
|
case "bin":
|
||||||
console.log(__dirname);
|
console.log(__dirname);
|
||||||
break;
|
break;
|
||||||
|
case "i":
|
||||||
|
case "install":
|
||||||
case "ls":
|
case "ls":
|
||||||
case "help":
|
case "help":
|
||||||
case "ping":
|
case "ping":
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue