Description
Several user_scan validators silently swallow parse failures on a 200 response and fall through to an unconditional Result.taken(), instead of returning Result.error(...) as required by the module guidelines:
Strict Error Handling: NEVER use raise Exception(). All unhandled states or unexpected status codes must return Result.error(f"Unexpected status code {resp.status_code}").
— CONTRIBUTING.md
When response.json() fails, or the parsed body doesn't have the expected keys, these modules report the username as taken rather than surfacing the failure — which can produce false positives whenever the API returns a malformed, rate-limited, or otherwise unexpected 200 body.
This is the same bug class fixed in cropty.py via #436 — this issue tracks the same pattern found elsewhere in the codebase.
Affected Files
| File |
Pattern |
user_scanner/user_scan/finance/destream.py |
except Exception: pass → falls through to return Result.taken() |
user_scanner/user_scan/gaming/apexlegends.py |
same |
user_scanner/user_scan/gaming/minecraft.py |
same |
user_scanner/user_scan/gaming/lichess.py |
same |
user_scanner/user_scan/gaming/chess_com.py |
same |
user_scanner/user_scan/dev/codecademy.py |
except Exception: return Result.taken() directly (any exception at all is reported as "taken") |
user_scanner/user_scan/dev/githubgist.py |
same as codecademy |
Example (destream.py)
def process(response):
if response.status_code == 200:
try:
data = response.json()
...
return Result.taken(extra=extra)
except Exception:
pass
return Result.taken() # ← silent fallthrough, should be Result.error(...)
if response.status_code == 404:
return Result.available()
return Result.error(f"Unexpected status: {response.status_code}")
Proposed Fix
Replace the bare fallback return Result.taken() (and the except Exception: return Result.taken() variant) in each file with an explicit Result.error(...), e.g.:
except Exception:
pass
return Result.error("Unexpected 200 response shape (no recognizable data)")
I'm happy to open a PR for this myself. Could I get assigned?
Description
Several
user_scanvalidators silently swallow parse failures on a200response and fall through to an unconditionalResult.taken(), instead of returningResult.error(...)as required by the module guidelines:When
response.json()fails, or the parsed body doesn't have the expected keys, these modules report the username as taken rather than surfacing the failure — which can produce false positives whenever the API returns a malformed, rate-limited, or otherwise unexpected200body.This is the same bug class fixed in
cropty.pyvia #436 — this issue tracks the same pattern found elsewhere in the codebase.Affected Files
user_scanner/user_scan/finance/destream.pyexcept Exception: pass→ falls through toreturn Result.taken()user_scanner/user_scan/gaming/apexlegends.pyuser_scanner/user_scan/gaming/minecraft.pyuser_scanner/user_scan/gaming/lichess.pyuser_scanner/user_scan/gaming/chess_com.pyuser_scanner/user_scan/dev/codecademy.pyexcept Exception: return Result.taken()directly (any exception at all is reported as "taken")user_scanner/user_scan/dev/githubgist.pyExample (
destream.py)Proposed Fix
Replace the bare fallback
return Result.taken()(and theexcept Exception: return Result.taken()variant) in each file with an explicitResult.error(...), e.g.:I'm happy to open a PR for this myself. Could I get assigned?