mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-01 01:09:22 +01:00
conf: rename ConfigValidationError -> ConfigurationError & inherit from RuntimeError
This commit is contained in:
parent
76b58c4432
commit
8386edc6d5
6
conf.py
6
conf.py
@ -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:
|
||||||
|
Loading…
Reference in New Issue
Block a user