diff --git a/src/auth.nim b/src/auth.nim
index a15766b..20e136f 100644
--- a/src/auth.nim
+++ b/src/auth.nim
@@ -125,6 +125,9 @@ proc getAccountPoolDebug*(): JsonNode =
proc rateLimitError*(): ref RateLimitError =
newException(RateLimitError, "rate limited")
+proc noAccountsError*(): ref NoAccountsError =
+ newException(NoAccountsError, "no accounts available")
+
proc isLimited(account: GuestAccount; api: Api): bool =
if account.isNil:
return true
@@ -165,7 +168,7 @@ proc getGuestAccount*(api: Api): Future[GuestAccount] {.async.} =
inc result.pending
else:
log "no accounts available for API: ", api
- raise rateLimitError()
+ raise noAccountsError()
proc setLimited*(account: GuestAccount; api: Api) =
account.apis[api].limited = true
diff --git a/src/nitter.nim b/src/nitter.nim
index dfc1dfd..958dc0b 100644
--- a/src/nitter.nim
+++ b/src/nitter.nim
@@ -97,6 +97,11 @@ routes:
resp Http429, showError(
&"Instance has been rate limited.
Use {link} or try again later.", cfg)
+ error NoAccountsError:
+ const link = a("another instance", href = instancesUrl)
+ resp Http429, showError(
+ &"Instance has no available accounts.
Use {link} or try again later.", cfg)
+
extend rss, ""
extend status, ""
extend search, ""
diff --git a/src/types.nim b/src/types.nim
index 1b9189b..d1981d7 100644
--- a/src/types.nim
+++ b/src/types.nim
@@ -6,6 +6,7 @@ genPrefsType()
type
RateLimitError* = object of CatchableError
+ NoAccountsError* = object of CatchableError
InternalError* = object of CatchableError
BadClientError* = object of CatchableError