This didn't change the public "API" used by modules. .core.io contains the IO classes, namely IOHandler, StandaloneIO and JSONIO .core.util contains SettingsBase and ClassFinder .core.exceptions contains all custom exceptions
25 lines
824 B
Python
25 lines
824 B
Python
|
|
class ConfigError(Exception):
|
|
"""ABC for configuration exceptions"""
|
|
def __init__(self, module, *args, **kwargs):
|
|
message = "Module '{0}': {1}".format(module, self.format(*args, **kwargs))
|
|
|
|
super().__init__(message)
|
|
|
|
class ConfigKeyError(ConfigError, KeyError):
|
|
def format(self, key):
|
|
return "invalid option '{0}'".format(key)
|
|
|
|
class ConfigMissingError(ConfigError):
|
|
def format(self, missing):
|
|
return "missing required options: {0}".format(missing)
|
|
super().__init__(module)
|
|
|
|
class ConfigAmbigiousClassesError(ConfigError):
|
|
def format(self, ambigious_classes):
|
|
return "ambigious module specification, found multiple classes: {0}".format(ambigious_classes)
|
|
|
|
class ConfigInvalidModuleError(ConfigError):
|
|
def format(self):
|
|
return "no class found"
|