Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hard to understand Exception for string type constraints #203

Open
s-heppner opened this issue Jan 4, 2024 · 2 comments
Open

Hard to understand Exception for string type constraints #203

s-heppner opened this issue Jan 4, 2024 · 2 comments
Labels
enhancement Enhancement of an existing feature sdk Something to do with the `sdk` package

Comments

@s-heppner
Copy link
Contributor

Currently, when string types (such as NameType, PathType, ContentType, ...) have their constraints violated, the exception mentions the name of the type that was violated.
This can be confusing, since the __init__-functions of the classes using these types in their attributes, only call for str in their type.
We should improve the error message in the exception to make it less confusing.

@s-heppner s-heppner added the enhancement Enhancement of an existing feature label Jan 4, 2024
@jkhsjdhjs
Copy link
Contributor

since the init-functions of the classes using these types in their attributes, only call for str in their type.

This isn't true, the __init__ functions also use types like NameType, PathType, etc.

@jkhsjdhjs
Copy link
Contributor

Ah, maybe you're referring to the docs, where the str type aliases are indeed shown as just str. Maybe we can use typing.NewType instead of the current way of just aliasing the str type.

@s-heppner s-heppner added the sdk Something to do with the `sdk` package label Nov 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement of an existing feature sdk Something to do with the `sdk` package
Projects
None yet
Development

No branches or pull requests

2 participants