From c3693e1c56f4b9a61dc3bdf7aeac225844976176 Mon Sep 17 00:00:00 2001 From: checkerschaf Date: Sun, 24 Apr 2022 22:15:02 +0200 Subject: [PATCH] fix: add fatal error logging --- cli.ts | 9 +++++++-- src/sherlock-scanner.ts | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/cli.ts b/cli.ts index 5f9088c..eac4638 100644 --- a/cli.ts +++ b/cli.ts @@ -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. @@ -11,7 +11,12 @@ const runSherlockCli = async (): Promise => { // 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 diff --git a/src/sherlock-scanner.ts b/src/sherlock-scanner.ts index aa09629..f5342ad 100644 --- a/src/sherlock-scanner.ts +++ b/src/sherlock-scanner.ts @@ -46,8 +46,8 @@ export class SherlockScanner { this.results.push(siteResult); this.onSiteProcessed(siteResult); resolve(); - }).catch(() => { - reject(); + }).catch((error) => { + reject(error); }); }, 1); });