diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2020-08-08 18:26:57 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2020-08-08 18:26:57 +0000 |
commit | c0d15f54edaf76cfac31fb725cb3d43d00a14724 (patch) | |
tree | a12380ee8bfa8b1688d14c127accb178121f8b9d /cfgv.py | |
parent | Releasing debian version 3.1.0-2. (diff) | |
download | cfgv-c0d15f54edaf76cfac31fb725cb3d43d00a14724.tar.xz cfgv-c0d15f54edaf76cfac31fb725cb3d43d00a14724.zip |
Merging upstream version 3.2.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'cfgv.py')
-rw-r--r-- | cfgv.py | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -395,11 +395,14 @@ def load_from_filename( if not os.path.exists(filename): raise ValidationError(f'{filename} does not exist') - with open(filename, encoding='utf-8') as f: - contents = f.read() - with validate_context(f'File {filename}'): try: + with open(filename, encoding='utf-8') as f: + contents = f.read() + except UnicodeDecodeError as e: + raise ValidationError(str(e)) + + try: data = load_strategy(contents) except Exception as e: raise ValidationError(str(e)) |