Use a more granular error type. I would recommend `ValueError` in this case.