Skip to content

Commit

Permalink
fix: spinners
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyichv committed Sep 17, 2024
1 parent 964ca16 commit 4e50a11
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/bright-houses-guess.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"arke-zod": patch
---

fix: spinners
4 changes: 3 additions & 1 deletion src/commands/pull.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ function findProject(projectKey: string) {

async function pullStructs(projectKey: string) {
const project = findProject(projectKey);
const spinner = ora("Building schemas...\n").start();

try {
const spinner = ora("Building schemas...\n").start();
const client = initClient(project);
const arkeList = await client.arke
.getAll()
Expand Down Expand Up @@ -92,13 +92,15 @@ async function pullStructs(projectKey: string) {
} catch (error) {
// @ts-expect-error
if (error?.response?.status === 401 || error?.response?.status === 403) {
spinner.stop();
const message =
// @ts-expect-error
clientErrorMap[error.response.status as keyof typeof clientErrorMap];
logger.warn(message);
await login(project);
return pullStructs(projectKey);
}
spinner.fail("Failed to build schemas");
handleError(error);
}
}

0 comments on commit 4e50a11

Please sign in to comment.