From 806fc5789a0f4e8f5d31cf2e62ffbe9be835ad90 Mon Sep 17 00:00:00 2001 From: zkldi Date: Mon, 19 Sep 2022 00:49:16 +0100 Subject: [PATCH] fix: new Error in JS takes a string, not an object future employers, please ignore this small mishap on part of the contributor. Consider hiring them, they're very good at their job and make excellent coffees. --- server/src/lib/database-seeds/repo.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/server/src/lib/database-seeds/repo.ts b/server/src/lib/database-seeds/repo.ts index 4035ec19d..3acc7ee62 100644 --- a/server/src/lib/database-seeds/repo.ts +++ b/server/src/lib/database-seeds/repo.ts @@ -214,19 +214,20 @@ export async function PullDatabaseSeeds( await fs.rm(seedsDir, { recursive: true, force: true }); try { + const branch = + Environment.nodeEnv === "production" + ? `release/${VERSION_INFO.major}.${VERSION_INFO.minor}` + : "staging"; + // stderr in git clone is normal output. // stdout is for errors. // there were expletives below this comment, but I have removed them. const { stdout: cloneStdout } = await asyncExec( - `git clone --sparse --depth=1 "${ServerConfig.SEEDS_CONFIG.REPO_URL}" -b "${ - Environment.nodeEnv === "production" - ? `release/${VERSION_INFO.major}.${VERSION_INFO.minor}` - : "staging" - }" "${seedsDir}"` + `git clone --sparse --depth=1 "${ServerConfig.SEEDS_CONFIG.REPO_URL}" -b "${branch}" "${seedsDir}"` ); if (cloneStdout) { - throw new Error({ stderr: cloneStdout }); + throw new Error(cloneStdout); } const { stdout: checkoutStdout } = await asyncExec( @@ -235,9 +236,10 @@ export async function PullDatabaseSeeds( ); // ^ now that we're in a monorepo, we only want the seeds. + // this shaves quite a bit of time off of the clone. if (checkoutStdout) { - throw new Error({ stderr: checkoutStdout }); + throw new Error(checkoutStdout); } return new DatabaseSeedsRepo(