The Trans Directory
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: better error handling on spawnsync failures

+32 -6
content/.gitkeep

This is a binary file and will not be displayed.

+29 -5
quartz/cli/handlers.js
··· 443 443 console.log( 444 444 "Pulling updates... you may need to resolve some `git` conflicts if you've made changes to components or plugins.", 445 445 ) 446 - gitPull(UPSTREAM_NAME, QUARTZ_SOURCE_BRANCH) 446 + 447 + try { 448 + gitPull(UPSTREAM_NAME, QUARTZ_SOURCE_BRANCH) 449 + } catch { 450 + console.log(chalk.red("An error occured above while pulling updates.")) 451 + await popContentFolder(contentFolder) 452 + return 453 + } 454 + 447 455 await popContentFolder(contentFolder) 448 456 console.log("Ensuring dependencies are up to date") 449 - spawnSync("npm", ["i"], { stdio: "inherit" }) 450 - console.log(chalk.green("Done!")) 457 + const res = spawnSync("npm", ["i"], { stdio: "inherit" }) 458 + if (res.status === 0) { 459 + console.log(chalk.green("Done!")) 460 + } else { 461 + console.log(chalk.red("An error occurred above while installing dependencies.")) 462 + } 451 463 } 452 464 453 465 /** ··· 504 516 console.log( 505 517 "Pulling updates from your repository. You may need to resolve some `git` conflicts if you've made changes to components or plugins.", 506 518 ) 507 - gitPull(ORIGIN_NAME, QUARTZ_SOURCE_BRANCH) 519 + try { 520 + gitPull(ORIGIN_NAME, QUARTZ_SOURCE_BRANCH) 521 + } catch { 522 + console.log(chalk.red("An error occured above while pulling updates.")) 523 + await popContentFolder(contentFolder) 524 + return 525 + } 508 526 } 509 527 510 528 await popContentFolder(contentFolder) 511 529 if (argv.push) { 512 530 console.log("Pushing your changes") 513 - spawnSync("git", ["push", "-f", ORIGIN_NAME, QUARTZ_SOURCE_BRANCH], { stdio: "inherit" }) 531 + const res = spawnSync("git", ["push", "-f", ORIGIN_NAME, QUARTZ_SOURCE_BRANCH], { 532 + stdio: "inherit", 533 + }) 534 + if (res.status !== 0) { 535 + console.log(chalk.red(`An error occurred above while pushing to remote ${ORIGIN_NAME}.`)) 536 + return 537 + } 514 538 } 515 539 516 540 console.log(chalk.green("Done!"))
+3 -1
quartz/cli/helpers.js
··· 36 36 const flags = ["--no-rebase", "--autostash", "-s", "recursive", "-X", "ours", "--no-edit"] 37 37 const out = spawnSync("git", ["pull", ...flags, origin, branch], { stdio: "inherit" }) 38 38 if (out.stderr) { 39 - throw new Error(`Error while pulling updates: ${out.stderr}`) 39 + throw new Error(chalk.red(`Error while pulling updates: ${out.stderr}`)) 40 + } else if (out.status !== 0) { 41 + throw new Error(chalk.red("Error while pulling updates")) 40 42 } 41 43 } 42 44