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

Error messages for datatype validation should be more telling #55

Closed
xrotwang opened this issue May 5, 2021 · 0 comments
Closed

Error messages for datatype validation should be more telling #55

xrotwang opened this issue May 5, 2021 · 0 comments
Assignees

Comments

@xrotwang
Copy link
Contributor

xrotwang commented May 5, 2021

Just raising blank ValueError here

csvw/src/csvw/metadata.py

Lines 322 to 340 in 85d5821

def validate(self, v):
if v is None:
return v
try:
l_ = len(v or '')
if self.length is not None and l_ != self.length:
raise ValueError()
if self.minLength is not None and l_ < self.minLength:
raise ValueError()
if self.maxLength is not None and l_ > self.maxLength:
raise ValueError()
except TypeError:
pass
if self.basetype.minmax:
if self.minimum is not None and v < self.minimum:
raise ValueError()
if self.maximum is not None and v > self.maximum:
raise ValueError()
return v

isn't very helpful.

@xrotwang xrotwang self-assigned this May 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant