Skip to content

Handle ModelNotFoundException in Cropty validation - #435

Closed
manav-py wants to merge 1 commit into
kaifcodec:mainfrom
manav-py:fix-cropty-validation
Closed

Handle ModelNotFoundException in Cropty validation#435
manav-py wants to merge 1 commit into
kaifcodec:mainfrom
manav-py:fix-cropty-validation

Conversation

@manav-py

Copy link
Copy Markdown

Summary

This PR updates the Cropty validation logic to inspect the response body for ModelNotFoundException before returning an unexpected status error.

What changed

  • Preserved the existing behavior for 200 and 404 responses.
  • Added a check for ModelNotFoundException in the response body for all other HTTP status codes.
  • Return Result.available() when the API indicates the user does not exist, even if the response status is not explicitly handled.

Why

Previously, only 200 and 404 responses were handled explicitly. Any other status code (such as 403, 429, or 500) would immediately return:

Result.error(f"Unexpected status: {response.status_code}")

without inspecting the response body.

With this change, if the API returns a ModelNotFoundException in the response body for an unexpected status code, it is correctly treated as an available username instead of an unexpected error.

@kaifcodec

Copy link
Copy Markdown
Owner

@mnv-cs You were spot on here as well! However, the approach in #436 turned out to be a bit cleaner. Another blocker was that the PR author and the commit author didn't match, which goes against our repository's contribution guidelines.

We really appreciate your time and effort on this though! You're always welcome to contribute again, whether that's adding new modules or fixing bugs. We'd be happy to review and merge your future PRs, just make sure your GitHub account matches the commit author next time.

@kaifcodec kaifcodec closed this Jul 24, 2026
@manav-py

manav-py commented Jul 24, 2026 via email

Copy link
Copy Markdown
Author
@kaifcodec

Copy link
Copy Markdown
Owner

No worries @mnv-cs !
You can join our User Scanner discord server from README badges, if you want to keep track on new issues and contribute further to user-scanner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants