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

parse_timedelta raises inconsistent errors for erroneous input #19

Closed
mwysokin opened this issue Dec 30, 2021 · 0 comments
Closed

parse_timedelta raises inconsistent errors for erroneous input #19

mwysokin opened this issue Dec 30, 2021 · 0 comments

Comments

@mwysokin
Copy link

For erroneous input I'd expect that parse_timedelta would raise a ValueError like in the docs (https://tempora.readthedocs.io/en/latest/#tempora.parse_timedelta). However I was able to trigger different types of exceptions which makes it difficult to handle errors properly.

  1. ValueError as expected:
>>> parse_timedelta("Matrix4")
ValueError: Unexpected 'Matrix'
  1. TypeError
>>> parse_timedelta("12345Matrix")
TypeError: 'matrixs' is an invalid keyword argument for __new__()
  1. UnboundLocalError
>>> parse_timedelta("MatrixFour")
UnboundLocalError: local variable 'match' referenced before assignment

Would it be possible to make the errors more consistent?

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

No branches or pull requests

1 participant