From 7fa478295496d16bfc99dd80858544900c7b0a4c Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sat, 7 Nov 2020 11:34:14 -0500 Subject: Return an error code when promise main() functions fail (#1002) --- dev/util.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'dev') diff --git a/dev/util.js b/dev/util.js index 971837af..c17cd29a 100644 --- a/dev/util.js +++ b/dev/util.js @@ -137,6 +137,16 @@ function createDictionaryArchive(dictionaryDirectory, dictionaryName) { } +async function testMain(func) { + try { + await func(); + } catch (e) { + console.log(e); + process.exit(-1); + } +} + + module.exports = { get JSZip() { return getJSZip(); }, getArgs, @@ -144,5 +154,6 @@ module.exports = { getDefaultManifest, getDefaultManifestAndVariants, createManifestString, - createDictionaryArchive + createDictionaryArchive, + testMain }; -- cgit v1.2.3