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

Add more robust error handling of BoundingBox inputs #62

Open
hollandjg opened this issue Oct 23, 2024 · 0 comments
Open

Add more robust error handling of BoundingBox inputs #62

hollandjg opened this issue Oct 23, 2024 · 0 comments

Comments

@hollandjg
Copy link
Collaborator

          What do you think about using a try/except block here in case a bad representation of a bbox, such as "1, 2, 3, 4, 5" or something that cannot be cast as int, is passed to the constructor?

I tried with these bad inputs:

>>> BoundingBoxParser.convert('1,2,3,"a"')
BoundingBox(x1=1, y1=2, x2=3, y2='a')

>>> BoundingBoxParser.convert('1,2,3,4,5')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "ebfloeseg\bbox.py", line 74, in convert     
    value = BoundingBox(*raw_value)
            ^^^^^^^^^^^^^^^^^^^^^^^
TypeError: BoundingBox.__new__() takes 5 positional arguments but 6 were given

In the former something that's not numeric was accepted, and in the latter the error message is somewhat misleading.

Originally posted by @cpaniaguam in #60 (comment)

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