Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/app/api/api-request.creator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ export class ApiRequestCreator {
return of(undefined);
}

if (data?.error === undefined && err.status == 429) {
this.bannerService.pushError("Rate Limited", "You have been rate-limited. Please try again later, and please try not to spam stuff again.")
return of(undefined);
}

this.bannerService.pushError(`API Error: ${data?.error?.name} (${err.status})`, data?.error?.message ?? "Unknown error")
return of(undefined);
}
Expand Down
4 changes: 4 additions & 0 deletions src/app/api/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ export class AuthService {
return;
}

// TODO hacky, find better solution. Should also reflect the time given in the response header, but Refresh currently only returns that on the first block...
if (err.statusCode === 429) err.message = "You have been rate-limited. Please try again in a few minutes, and please stop spamming this button.";
this.bannerService.pushError('Failed to sign in', err.message ?? "No error was provided by the server. Check the console for more details.")
console.error(err);
}
Expand Down Expand Up @@ -152,6 +154,8 @@ export class AuthService {
return;
}

// TODO hacky, find better solution. Should also reflect the time given in the response header, but Refresh currently only returns that on the first block...
if (err.statusCode === 429) err.message = "You have been rate-limited. Please try again in an hour or less, and please stop spamming this button.";
this.bannerService.pushError('Failed to register', err.message ?? "No error was provided by the server. Check the console for more details.")
console.error(err);
}
Expand Down
Loading