0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-30 22:03:56 -05:00

Improve the unauthorized error output

This commit is contained in:
Matthew Phillips 2024-02-14 12:41:09 -05:00
parent e74c6445af
commit 26de0b878e

View file

@ -1,6 +1,6 @@
import type { AstroConfig } from 'astro';
import { mkdir, writeFile } from 'node:fs/promises';
import { red } from 'kleur/colors';
import { bgRed, cyan } from 'kleur/colors';
import prompts from 'prompts';
import type { Arguments } from 'yargs-parser';
import { PROJECT_ID_FILE, getSessionIdFromFile } from '../../../tokens.js';
@ -31,7 +31,7 @@ export async function cmd({ flags }: { config: AstroConfig; flags: Arguments })
if (!response.ok) {
// Unauthorized
if(response.status === 401) {
console.error(`${red('Unauthorized')}.\n\nAre you logged in? Run \`astro db login\` to authenticate and then try linking again.`);
console.error(`${bgRed('Unauthorized')}\n\n Are you logged in?\n Run ${cyan('astro db login')} to authenticate and then try linking again.\n\n`);
process.exit(1);
}