Skip to content

Commit

Permalink
Update error message
Browse files Browse the repository at this point in the history
  • Loading branch information
bherr2 committed Dec 10, 2024
1 parent a7010a7 commit 0509f84
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/utils/sh-exec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -53,4 +53,4 @@ export function logOnError(command, message, { errorFile, errorParser=defaultPar

function defaultParser(message) {
return message;
}
}

0 comments on commit 0509f84

Please sign in to comment.