mirror of
https://github.com/zedeus/nitter
synced 2026-09-05 22:59:31 +00:00
Raise NoAccountsError when all accounts limited
This commit is contained in:
parent
19569bb19f
commit
28d3ed7d9f
3 changed files with 10 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue