from pgwui_core import exceptions as core_ex
from pgwui_core.exceptions import ( # noqa: F401
PGWUIError,
- UploadError as Error,
+ UploadError,
SetupError,
)
from . import constants
'and the pgwui.menu_page setting used instead')
-class BadHMACError(Error):
+class BadHMACError(SetupError):
pass
.format(constants.HMAC_LEN))
-class UnknownSettingKeyError(Error):
+class UnknownSettingKeyError(SetupError):
def __init__(self, key):
super().__init__('Unknown PGWUI setting: {}'.format(key))
-class MissingSettingError(Error):
+class MissingSettingError(SetupError):
def __init__(self, key):
super().__init__('Missing PGWUI setting: {}'.format(key))
-class BadPageTypeError(Error):
+class BadPageTypeError(SetupError):
def __init__(self, key, val):
super().__init__(f'Bad {key} setting ({val})')
-class BadPageSourceError(Error):
+class BadPageSourceError(SetupError):
def __init__(self, msg):
super().__init__(msg)
'does not look like a Pyramid asset specification')
-class NotBooleanSettingError(Error):
+class NotBooleanSettingError(SetupError):
def __init__(self, key, value):
super().__init__(
f'Bad value ({value}) for the {key} setting',
.format(key))
-class NotBooleanChoiceSettingError(Error):
+class NotBooleanChoiceSettingError(SetupError):
def __init__(self, key, value):
super().__init__(
f'Bad value ({value}) for the {key} setting',
'"yes-always", "choice-yes", "choice-no", "no-never"'))
-class BadAssetOverrideError(Error):
+class BadAssetOverrideError(SetupError):
def __init__(self, asset, new_asset, exp):
super().__init__(
f'The asset ({asset}) cannot be overridden with ({new_asset}):'
f' {exp}')
-class BadSettingError(Error):
+class BadSettingError(SetupError):
def __init__(self, exp):
super().__init__(
f'Bad settings caused an error: {exp}'
'\nHint: Overriding non-existant assets can cause this problem')
-class BadPathError(Error):
+class BadPathError(SetupError):
pass
'an asset that does not exist')
-class ViewError(Error):
+class ViewError(SetupError):
pass
# when exiting the configuration context raises a configuration
# execution error.
assert isinstance(common_ex.BadSettingError('foo'),
- common_ex.Error)
+ common_ex.SetupError)
# Functional tests
def test_unknownsettingkeyerror():
'''Takes an argument'''
assert isinstance(common_ex.UnknownSettingKeyError('key'),
- common_ex.Error)
+ common_ex.SetupError)
@pytest.mark.integrationtest
def test_missingsettingerror():
'''Takes an argument'''
assert isinstance(common_ex.MissingSettingError('key'),
- common_ex.Error)
+ common_ex.SetupError)
@pytest.mark.integrationtest
def test_notbooleansettingerror():
'''Takes two arguments'''
assert isinstance(common_ex.NotBooleanSettingError('key', 'val'),
- common_ex.Error)
+ common_ex.SetupError)