0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-02-10 22:38:53 -05:00

Handle unauthorized linking

This commit is contained in:
Matthew Phillips 2024-02-13 16:55:40 -05:00
parent 104f071b93
commit 168f3ae389

View file

@ -28,6 +28,12 @@ export async function cmd({ flags }: { config: AstroConfig; flags: Arguments })
body: JSON.stringify(body)
});
if (!response.ok) {
// Unauthorized
if(response.status === 401) {
console.error('Unauthorized. Are you logged-in? Run `astro db login` to authenticate and then try linking again.');
process.exit(1);
}
console.error(`Failed to link project: ${response.status} ${response.statusText}`);
process.exit(1);
}