Handle FileNotFoundError when config file not found
@@ -47,7 +47,12 @@ class ProfileNotFoundError(ConfigException):
def _read_config(path):
- with open(path) as fh:
+ try:
+ fh = open(path)
+ except FileNotFoundError:
+ raise ConfigException(f"Cannot find config file '{path}'")
+ else:
+ with fh:
try:
return json.load(fh)
except json.decoder.JSONDecodeError:
