From 0509f848aec891c941e3ad71e5bbd22cbeddd91c Mon Sep 17 00:00:00 2001 From: "Bruce W. Herr II" Date: Tue, 10 Dec 2024 15:13:54 -0500 Subject: [PATCH] Update error message --- src/utils/sh-exec.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/utils/sh-exec.js b/src/utils/sh-exec.js index bb65b43..1da6aef 100644 --- a/src/utils/sh-exec.js +++ b/src/utils/sh-exec.js @@ -6,10 +6,10 @@ import { error, more } from './logging.js'; export function exec(command) { const response = sh.exec(command); const { stdout, code } = response; - return (code === 1) ? null : stdout.trim(); + return code === 1 ? null : stdout.trim(); } -export function throwOnError(command, message, errorParser=defaultParser) { +export function throwOnError(command, message, errorParser = defaultParser) { const response = sh.exec(command); const { stdout, stderr, code } = response; const success = code !== 1; @@ -24,11 +24,11 @@ export function throwOnError(command, message, errorParser=defaultParser) { errorMessage = errorParser(stdout); } } - throw new Error(errorMessage); + throw new Error(`"${command}" had an error: ${errorMessage}`); } } -export function logOnError(command, message, { errorFile, errorParser=defaultParser }) { +export function logOnError(command, message, { errorFile, errorParser = defaultParser }) { const response = sh.exec(command, { silent: true }); const { stdout, stderr, code } = response; const success = code !== 1; @@ -53,4 +53,4 @@ export function logOnError(command, message, { errorFile, errorParser=defaultPar function defaultParser(message) { return message; -} \ No newline at end of file +}