Skip to content

Commit f126331

Browse files
feat: improve complaint when gh auth status fails (#420)
## PR Checklist - [x] Addresses an existing open issue: fixes #400 - [x] That issue was marked as [`status: accepting prs`](https://github.com/JoshuaKGoldberg/template-typescript-node-package/issues?q=is%3Aopen+is%3Aissue+label%3A%22status%3A+accepting+prs%22) - [x] Steps in [CONTRIBUTING.md](https://github.com/JoshuaKGoldberg/template-typescript-node-package/blob/main/.github/CONTRIBUTING.md) were taken ## Overview Uses a `try`/`catch` with a manual `console.error`. Because this is really part of the script setup, directly calls `process.exit(0)` instead of throwing an error through the normal handling.
1 parent da74074 commit f126331

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

script/setup.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,15 @@ try {
9292

9393
await withSpinner(
9494
async () => {
95-
await $`gh auth status`;
95+
try {
96+
await $`gh auth status`;
97+
} catch (error) {
98+
console.error();
99+
console.error(chalk.red(error.message));
100+
console.error();
101+
process.exit(0);
102+
}
103+
96104
const auth = (await $`gh auth token`).stdout.trim();
97105

98106
octokit = new Octokit({ auth });

0 commit comments

Comments
 (0)