take into account authorizationError for skipping account

351337aade
This commit is contained in:
taskylizard 2024-05-19 06:37:13 +00:00
parent 372b58d1fe
commit af1d873de0
No known key found for this signature in database
GPG key ID: 1820131ED1A24120
2 changed files with 4 additions and 3 deletions

View file

@ -109,7 +109,7 @@ template fetchImpl(result, additional_headers, fetchBody) {.dirty.} =
if result.startsWith("{\"errors"):
let errors = result.fromJson(Errors)
if errors in {expiredToken, badToken}:
if errors in {expiredToken, badToken, authorizationError}:
echo "fetch error: ", errors
invalidate(account)
raise rateLimitError()
@ -159,7 +159,7 @@ proc fetch*(url: Uri; api: Api; additional_headers: HttpHeaders = newHttpHeaders
result = newJNull()
let error = result.getError
if error in {expiredToken, badToken}:
if error in {expiredToken, badToken, authorizationError}:
echo "fetchBody error: ", error
invalidate(account)
raise rateLimitError()

View file

@ -62,9 +62,10 @@ type
tweetNotAuthorized = 179
forbidden = 200
badToken = 239
authorizationError = 326
noCsrf = 353
tweetUnavailable = 421
tweetCensored = 422
tweetCensored = 426
VerifiedType* = enum
none = "None"