- Better error reporting.

- Flask now uses application's logger instead of its own.
- ucloud file scanner refactored.
This commit is contained in:
ahmadbilalkhalid 2019-12-23 12:58:04 +05:00
commit 972bb5a920
14 changed files with 157 additions and 154 deletions

View file

@ -5,7 +5,6 @@ import os
from ucloud.common.etcd_wrapper import Etcd3Wrapper
logger = logging.getLogger(__name__)
@ -14,8 +13,9 @@ class CustomConfigParser(configparser.RawConfigParser):
try:
result = super().__getitem__(key)
except KeyError as err:
raise KeyError("Key '{}' not found in config file"\
.format(key)) from err
raise KeyError(
'Key \'{}\' not found in configuration. Make sure you configure ucloud.'.format(key)
) from err
else:
return result
@ -78,7 +78,7 @@ class Settings(object):
if config_from_etcd:
self.config_parser.read_dict(config_from_etcd.value)
else:
raise KeyError("Key '{}' not found in etcd".format(self.config_key))
raise KeyError("Key '{}' not found in etcd. Please configure ucloud.".format(self.config_key))
def __getitem__(self, key):
self.read_values_from_etcd()