-
Notifications
You must be signed in to change notification settings - Fork 10
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
Provide more specific exceptions/errors than just value_error #158
Comments
is there a specific list you would like that you would do something programmatic with (i.e. the semantics of typing are useful to you somewhere)? if it's primarily for humans, we should just go through the messages and improve them. also if you simply want to know its from dandischema, we can create a special |
So far I see clear distinction only for As for why -- we are taking that |
Related to dandi/dandi-archive#1490. |
@yarikoptic - most of the exceptions come directly from pydantic. are you only saying to have a |
What matters for me is that class DandiValueError(ValueError, DandiSchemaError):
pass
class DandiMissingValueError(DandiValueError):
pass and throughout dandi-schema code base use |
can we just leave it as pydantic? i can replace where we generate In [12]: try:
...: Dandiset()
...: except ValidationError as e:
...: print(e.__repr__())
...:
|
we will have to also decide what we do with both JSON validation and pydantic validation, which are both created in the validation function. |
For my current need having |
ATM we use ValueError as a generic exception for when value is not the one we like to have
and some of them in particular whenever we indicate that the value is required! (not sure why we make it optional then to start with? didn't check)
That results that whenever we catch ValidationError in dandi-cli we cannot really tell if it is the error that value is completely absent or something else without matching a message (unreliable, shouldn't be done):
I guess (didn't check) if we specialize to other types of derived from ValueError exceptions, like
MissingValue(ValueError)
we might get'type': 'missing_value'
?The text was updated successfully, but these errors were encountered: