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.