Skip to content

Commit

Permalink
Prevent search endpoint from discarding tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
zedeus committed Apr 20, 2023
1 parent 95893ee commit e2560dc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/apiutils.nim
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ proc fetch*(url: Uri; api: Api): Future[JsonNode] {.async.} =
updateToken()

let error = result.getError
if error in {invalidToken, forbidden, badToken}:
if error in {invalidToken, badToken}:
echo "fetch error: ", result.getError
release(token, invalid=true)
raise rateLimitError()
Expand All @@ -123,7 +123,7 @@ proc fetchRaw*(url: Uri; api: Api): Future[string] {.async.} =

if result.startsWith("{\"errors"):
let errors = result.fromJson(Errors)
if errors in {invalidToken, forbidden, badToken}:
if errors in {invalidToken, badToken}:
echo "fetch error: ", errors
release(token, invalid=true)
raise rateLimitError()

0 comments on commit e2560dc

Please sign in to comment.