diff --git a/src/services/githubSyncService.js b/src/services/githubSyncService.js index fd2b64a..a2cbd6e 100644 --- a/src/services/githubSyncService.js +++ b/src/services/githubSyncService.js @@ -44,7 +44,7 @@ function fetchPublicRepositories(owner) { }, ); - if (result.status !== 0) { + if (result.status !== 0 || result.error) { const stderr = typeof result.stderr === "string" ? result.stderr.trim() : ""; const stdout = typeof result.stdout === "string" ? result.stdout.trim() : ""; const processError = diff --git a/src/services/releaseDayService.js b/src/services/releaseDayService.js index 6ed5385..456bee8 100644 --- a/src/services/releaseDayService.js +++ b/src/services/releaseDayService.js @@ -27,7 +27,7 @@ function runCommand(command, args) { encoding: "utf8", }); - if (result.status !== 0) { + if (result.status !== 0 || result.error) { const stderr = typeof result.stderr === "string" ? result.stderr.trim() : ""; const stdout = typeof result.stdout === "string" ? result.stdout.trim() : ""; const processError = diff --git a/src/services/trackerSyncService.js b/src/services/trackerSyncService.js index 090e01a..8176db3 100644 --- a/src/services/trackerSyncService.js +++ b/src/services/trackerSyncService.js @@ -30,13 +30,18 @@ function runPowerShellScript(script) { encoding: "utf8", }); - if (result.status !== 0) { + if (result.status !== 0 || result.error) { + const stderr = typeof result.stderr === "string" ? result.stderr.trim() : ""; + const stdout = typeof result.stdout === "string" ? result.stdout.trim() : ""; + const processError = + result.error && result.error.message ? result.error.message : ""; + throw new Error( - result.stderr.trim() || result.stdout.trim() || "PowerShell script failed.", + processError || stderr || stdout || "PowerShell script failed.", ); } - return result.stdout.trim(); + return typeof result.stdout === "string" ? result.stdout.trim() : ""; } /**