From 8df4fbcb8ed2c818fab1b1b6f8ef0f983b1e91c3 Mon Sep 17 00:00:00 2001 From: Laurent Desausoi Date: Mon, 26 Aug 2024 14:07:53 +0200 Subject: [PATCH] return an error code when the parsed CSS stdin is invalid --- bin/rtlcss.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/bin/rtlcss.js b/bin/rtlcss.js index ce6214a..95e54cb 100644 --- a/bin/rtlcss.js +++ b/bin/rtlcss.js @@ -278,11 +278,23 @@ function main () { buffer += data }) process.on('SIGINT', () => { - processCSSFile(false, buffer) + try { + processCSSFile(false, buffer) + } catch (e) { + currentErrorcode = ErrorCodes.ProcessingError + printError('rtlcss: error processing payload') + printError(e) + } process.exit() }) process.stdin.on('end', () => { - processCSSFile(false, buffer) + try { + processCSSFile(false, buffer) + } catch (e) { + currentErrorcode = ErrorCodes.ProcessingError + printError('rtlcss: error processing payload') + printError(e) + } }) } }