Commit 4ea99f46 authored by echel0n's avatar echel0n

Added exception handling for corrupt config files.

parent 9d20d412
......@@ -93,6 +93,7 @@ class API(object):
self.token = self.session.refresh_token(self.token_url, **extra)
except (InvalidClientIdError, MissingTokenError, InvalidGrantError) as e:
latest_exception = "Invalid token error, please re-authenticate by logging out then logging back in from web-ui"
except requests.exceptions.ReadTimeout:
timeout += timeout
except requests.exceptions.HTTPError as e:
......@@ -1373,7 +1373,10 @@ class Config(object):
# decrypt config
self.config_obj = ConfigObj(encoding='utf8')
if os.path.exists(config_file):
self.config_obj = self.decrypt_config(config_file)
self.config_obj = self.decrypt_config(config_file)
except Exception:
raise SystemExit("Unable to decrypt config file {}, config is most likely corrupted and needs to be deleted.".format(config_file))
# use defaults
if defaults:
......@@ -2388,7 +2391,7 @@ class Config(object):
return config_obj or ConfigObj(encoding='utf8')
return config_obj
def legacy_encrypt(self, section, key, encryption_version, encryption_secret, _decrypt=False):
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment