Use SetupError name from pgwui_core instead of just Error
authorKarl O. Pinc <kop@karlpinc.com>
Tue, 27 Apr 2021 20:57:11 +0000 (15:57 -0500)
committerKarl O. Pinc <kop@karlpinc.com>
Tue, 27 Apr 2021 20:57:11 +0000 (15:57 -0500)
src/pgwui_common/exceptions.py
tests/test_exceptions.py

index ab71e8a863c7db13832ae6d5b51ecf4bfa2748c5..1015cedd98a2c24f731182df8ddf3c7a1cf742c9 100644 (file)
@@ -26,7 +26,7 @@
 from pgwui_core import exceptions as core_ex
 from pgwui_core.exceptions import (  # noqa: F401
     PGWUIError,
-    UploadError as Error,
+    UploadError,
     SetupError,
 )
 from . import constants
@@ -45,7 +45,7 @@ class MenuPageInRoutes(Info):
             'and the pgwui.menu_page setting used instead')
 
 
-class BadHMACError(Error):
+class BadHMACError(SetupError):
     pass
 
 
@@ -61,22 +61,22 @@ class HMACLengthError(BadHMACError):
             .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)
 
@@ -117,7 +117,7 @@ class BadAssetSourceError(BadPageSourceError):
             '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',
@@ -125,7 +125,7 @@ class NotBooleanSettingError(Error):
             .format(key))
 
 
-class NotBooleanChoiceSettingError(Error):
+class NotBooleanChoiceSettingError(SetupError):
     def __init__(self, key, value):
         super().__init__(
             f'Bad value ({value}) for the {key} setting',
@@ -133,21 +133,21 @@ class NotBooleanChoiceSettingError(Error):
              '"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
 
 
@@ -167,7 +167,7 @@ class BadAssetError(BadPathError):
             'an asset that does not exist')
 
 
-class ViewError(Error):
+class ViewError(SetupError):
     pass
 
 
index 43ad7b853457e870f8906f2aa34957005d37d8af..48b8ac4d5e104b9b07fff0afd57a429dbc7f48fa 100644 (file)
@@ -33,7 +33,7 @@ def test_badsettingerror():
     # when exiting the configuration context raises a configuration
     # execution error.
     assert isinstance(common_ex.BadSettingError('foo'),
-                      common_ex.Error)
+                      common_ex.SetupError)
 
 
 # Functional tests
@@ -42,18 +42,18 @@ def test_badsettingerror():
 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)