Except block now covers specific errors
Previously too broad exception has been refactored, in order to stop truly unexpected issues from hiding. Only ParsingError and OSError is now caught by the block. Signed-off-by: Jiri Podivin <jpodivin@redhat.com> Change-Id: I685b6b325fc2c252cb7e656f369a60f958fa72bf
This commit is contained in:
parent
3d6e5a1962
commit
2470d54bbd
@ -60,7 +60,7 @@ def get_result(path, section, key, default=None):
|
||||
|
||||
try:
|
||||
config.read(path)
|
||||
except Exception:
|
||||
except (OSError, ConfigParser.ParsingError):
|
||||
msg = "The file '{}' is not in a valid INI format.".format(path)
|
||||
ret = ReturnValue.INVALID_FORMAT
|
||||
return (ret, msg, value)
|
||||
|
Loading…
x
Reference in New Issue
Block a user