Skip to content

Should we be catching and handling TypeAdapter validation errors? #1440

@nathanjmcdougall

Description

@nathanjmcdougall

TypeAdapter(str).validate_python(project_key) can raise a pydantic.ValidationError, which won’t be caught by the CLI layer (it only catches UsethisError). Consider catching ValidationError here and re-raising as InvalidSonarQubeProjectKeyError with a message pointing to tool.usethis.sonarqube.project-key, so mis-typed config values produce a clean, user-facing error instead of a traceback.

Originally posted by @Copilot in #1439 (comment)

Metadata

Metadata

Labels

philosophyDetermining the best design approach

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions