3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-27 13:09:23 +01:00

conf: rename ConfigValidationError -> ConfigurationError & inherit from RuntimeError

This commit is contained in:
James Lu 2018-06-13 22:46:58 -07:00
parent 76b58c4432
commit 8386edc6d5

View File

@ -17,7 +17,7 @@ from collections import defaultdict
from . import world from . import world
class ConfigValidationError(Exception): class ConfigurationError(RuntimeError):
"""Error when config conditions aren't met.""" """Error when config conditions aren't met."""
conf = {'bot': conf = {'bot':
@ -50,9 +50,9 @@ conf['pylink'] = conf['bot']
confname = 'unconfigured' confname = 'unconfigured'
def validate(condition, errmsg): def validate(condition, errmsg):
"""Raises ConfigValidationError with errmsg unless the given condition is met.""" """Raises ConfigurationError with errmsg unless the given condition is met."""
if not condition: if not condition:
raise ConfigValidationError(errmsg) raise ConfigurationError(errmsg)
def _log(level, text, *args, logger=None, **kwargs): def _log(level, text, *args, logger=None, **kwargs):
if logger: if logger: