Skip to content

Commit 4fb2f02

Browse files
committed
fix: ensure unhandled promises fail
1 parent 7c95a41 commit 4fb2f02

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/commands/upload.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ export class UploadCommand {
5858
}
5959

6060
async run(path = './') {
61+
if (!fs.existsSync(fsPath.resolve(path))) {
62+
throw new Error(`Path ${path} does not exist. Nothing to upload.`);
63+
}
64+
6165
const gitData = await getGitData(path);
6266
const config = findConfig(path);
6367
const ttl = this.options.ttl ? new Date(this.options.ttl) : undefined;

src/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ import {createCommand} from 'commander';
66

77
const program = createCommand();
88

9+
// Ensure unhandled promises cause the command to fail.
10+
process.on('unhandledRejection', err => {
11+
throw err;
12+
});
13+
914
program
1015
.command('upload [dir]')
1116
.description('Uploads a directory to cloud storage')

0 commit comments

Comments
 (0)