I would suggest to change the Exception type as a ValueError