From ca2177abccd89f54668950e173e5acd7fa24cfe7 Mon Sep 17 00:00:00 2001 From: Jahed Ahmed Date: Thu, 19 Aug 2021 18:20:07 +0000 Subject: [PATCH] fix(protect): catch and log unexpected errors Otherwise we'll get "UnhandledPromiseRejectionWarning" warnings from NodeJS which warns us that their behaviour will change to non-zero exit codes in the future. We don't want that and we shouldn't block pipelines due to failures on our end. --- packages/snyk-protect/bin/snyk-protect | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/snyk-protect/bin/snyk-protect b/packages/snyk-protect/bin/snyk-protect index 0eef1829f1..58e501654c 100755 --- a/packages/snyk-protect/bin/snyk-protect +++ b/packages/snyk-protect/bin/snyk-protect @@ -1,2 +1,7 @@ #!/usr/bin/env node -require('../dist/index.js').protect(); +require('../dist/index.js') + .protect() + .catch((error) => { + // don't block pipelines on unexpected errors + console.error(error); + });