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

Return a better error for invalid dates #154

Merged
merged 1 commit into from
Feb 13, 2017

Conversation

rmarianski
Copy link
Member

When we get invalid dates, we can have the edtf date api return back None for earliest/latest dates. This adds a check to guard against that, and return back a better error message in this case. Otherwise, the min or something else downstream will raise a general error when it's first used.

@rmarianski
Copy link
Member Author

@zerebubuth, @iandees can you review please?

tilequeue/wof.py Outdated
cessation_latest = edtf_cessation.date_latest()
deprecated_latest = edtf_deprecated.date_latest()
if inception_earliest is None:
return failure('invalid edtf:inception: %s' % props['edtf:inception'])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's possible for props not to have an edtf:... key, which is hidden by _normalize_edtf returning a valid EDTF object when given None. This might cause a KeyError here, though?

Perhaps failure('invalid edtf:inception: %r' % props.get('edtf:inception'))?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well spotted! Fixed in f133a5d.

@rmarianski rmarianski force-pushed the wof-better-failure-invalid-date branch from f133a5d to 0cbd908 Compare February 13, 2017 18:00
@rmarianski rmarianski merged commit 4a172fd into master Feb 13, 2017
@rmarianski rmarianski deleted the wof-better-failure-invalid-date branch February 13, 2017 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants