From 22caa199f2e5417445c147005cfc64bb165c1799 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Wed, 14 Apr 2021 23:01:43 +0200 Subject: [PATCH] Actually return promise in Comb::processFile This makes it possible to catch exceptions in `processFiles` in `cli.js`. Without this, node raises an error when promise throws an exception: node:internal/process/promises:245 triggerUncaughtException(err, true /* fromPromise */); ^ [UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "[object Object]".] { code: 'ERR_UNHANDLED_REJECTION' } --- src/core.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core.js b/src/core.js index eea63d2f..419f60ea 100644 --- a/src/core.js +++ b/src/core.js @@ -188,7 +188,7 @@ class Comb { return new Promise(resolve => { vfs.read(path, 'utf8').then(function(data) { let syntax = that._extractSyntax(path); - that.processString(data, { + return that.processString(data, { syntax: syntax, filename: path }).then(function(processedData) {