How about:
```
except Exception as err:
    raise ValueError('Format function for value {0} failed: {1}'.format(val, err))
```
(Note, using the continuation character `\` in the string generated a bunch of whitespace in the exception message).