Skip to content

Commit

Permalink
fix: add fatal error logging
Browse files Browse the repository at this point in the history
  • Loading branch information
checkerschaf committed Apr 24, 2022
1 parent 740b555 commit c3693e1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
9 changes: 7 additions & 2 deletions cli.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { SherlockScanner } from "./src/sherlock-scanner.ts";
import { printFatalError } from "./src/errors.ts";
import { readCliArguments } from "./src/cli.ts";
import { printFatalError } from "./src/errors.ts";

/**
* This is the entry point to the Sherlock-CLI.
Expand All @@ -11,7 +11,12 @@ const runSherlockCli = async (): Promise<void> => {

// Start the scan and wait for it to finish
await scanner
.scan();
.scan()
.catch((err: Error) => {
printFatalError(err);
Deno.exit(1);
})
.finally(() => Deno.exit(0));
};

// Start the Sherlock-CLI
Expand Down
4 changes: 2 additions & 2 deletions src/sherlock-scanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ export class SherlockScanner {
this.results.push(siteResult);
this.onSiteProcessed(siteResult);
resolve();
}).catch(() => {
reject();
}).catch((error) => {
reject(error);
});
}, 1);
});
Expand Down

0 comments on commit c3693e1

Please sign in to comment.