diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2020-08-08 18:26:53 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2020-08-08 18:26:53 +0000 |
commit | 0be043545b0aa18aed1a585170b2ddce9cfdb968 (patch) | |
tree | d38233ecfcb80ab290c545a6c26f1f692abba809 /cfgv.py | |
parent | Adding upstream version 3.1.0. (diff) | |
download | cfgv-0be043545b0aa18aed1a585170b2ddce9cfdb968.tar.xz cfgv-0be043545b0aa18aed1a585170b2ddce9cfdb968.zip |
Adding upstream version 3.2.0.upstream/3.2.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-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)) |