HomeSoftware Heritage

Make unreachable `raise ValueError` come into play

Description

Make unreachable raise ValueError come into play

The current code looks for a -1 return value from the string.index
method (as e.g. string.find yields), but string.index will raise a
ValueError if the character is not found, breaking out of the block
before being able to check the value.

Catch the ValueError from string.index and raise a new one with the
intended exception message instead.

Details

Provenance
Daniel Andersson <dandersson@users.noreply.github.com>Authored on Nov 10 2017, 5:16 PM
ardumontPushed on Sep 27 2021, 5:34 PM
Parents
rPPDW694d27c2b063: objects: Add checks on date fields (tag, commit alike)
Branches
Unknown
Tags
Unknown

Event Timeline