Skip to content

Commit

Permalink
feat: Adding check for unauthorized responses (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
lifeofpavs authored Oct 2, 2024
1 parent 9b3dafc commit 06f4c7f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ export class Tinybird {
await new Promise((r) => setTimeout(r, 1000 + i ** 2 * 50));
continue;
}

if (res.status === 403) {
throw new Error("Unauthorized");
}

if (!res.ok) {
const error = (await res.json()) as PipeErrorResponse;
throw new Error(error.error);
Expand Down

0 comments on commit 06f4c7f

Please sign in to comment.