Name exception SetupError instead of Error
authorKarl O. Pinc <kop@karlpinc.com>
Wed, 28 Apr 2021 23:54:25 +0000 (18:54 -0500)
committerKarl O. Pinc <kop@karlpinc.com>
Wed, 28 Apr 2021 23:54:25 +0000 (18:54 -0500)
src/pgwui_core/core.py
src/pgwui_core/exceptions.py

index a9ff9646b17166f38d17ac77285ba06eec870e72..31058b4d36ceb9f99d43e8053d473b384aa83c74 100644 (file)
@@ -1493,7 +1493,7 @@ class DBConnector(object):
 
         Returns:
           (errors, response)
-          errors       List of core_ex.Error instances
+          errors       List of core_ex.SetupError instances
           response     Dict pyramid will use to render the resulting form.
                        The dict returned by func(conn) plus reserved keys.
                        Reserved keys:
@@ -1579,7 +1579,7 @@ class DBConnector(object):
 
         Returns:
           (errors, response)
-            errors   List of core_ex.Error instantiations
+            errors   List of core_ex.PGWUIError instantiations
             response   Dict containing connection result info
 
         Side effects:
@@ -1630,10 +1630,11 @@ class NoTransactionEngine(DBConnector):
         a transaction.
 
         func(conn)  Call this function with the connection.
-                    func(conn) must return a list of core_ex.Error instances
+                    func(conn) must return a list of core_ex.PGWUIError
+                    instances
 
         Returns:
-          errors       List of core_ex.Error instances
+          errors       List of core_ex.PGWUIError instances
         Side effects:
           Calls func(conn)
         '''
@@ -1703,10 +1704,11 @@ class UnsafeUploadEngine(DBConnector):
         Call a database modification function with a connection.
 
         func(conn)  Call this function with the connection.
-                    func(conn) must return a list of core_ex.Error instances
+                    func(conn) must return a list of core_ex.PGWUIError
+                    instances
 
         Returns:
-          errors       List of core_ex.Error instances
+          errors       List of core_ex.PGWUIError instances
         Side effects:
           Calls func(conn)
         '''
@@ -1844,12 +1846,12 @@ class UploadEngine(UnsafeUploadEngine):
 
         func(conn)  Call this function with the connection.
                     f(conn) must return a (errors, dict) tuple result,
-                        errors   list of core_ex.Error instances
+                        errors   list of core_ex.PWGUIError instances
                         dict     other results
 
         Returns:
           (errors, response)
-          errors     List of core_ex.Error instances
+          errors     List of core_ex.PGWUIError instances
           response     Dict pyramid will use to render the resulting form.
                        The dict returned by func(conn) plus reserved keys.
                        Reserved keys:
index da4464303203a512119a885a8e1ef48d673586ec..3b71ed8807d11a24f3dcab04497f7d716dfb77a3 100644 (file)
@@ -89,7 +89,7 @@ class UploadError(PGWUIError):
         return self
 
 
-class Error(UploadError):
+class SetupError(UploadError):
     '''
     Module exceptions raised while setting up to read data lines
     are derived from this class.
@@ -99,75 +99,75 @@ class Error(UploadError):
     detail Extra HTML describing the error
     '''
     def __init__(self, e, descr='', detail=''):
-        super(Error, self).__init__(e=e, descr=descr, detail=detail)
+        super(SetupError, self).__init__(e=e, descr=descr, detail=detail)
 
 
-class NoFileError(Error):
+class NoFileError(SetupError):
     '''No file uploaded'''
     def __init__(self, e, descr='', detail=''):
         super(NoFileError, self).__init__(e, descr, detail)
 
 
-class NoDBError(Error):
+class NoDBError(SetupError):
     '''No database name given'''
     def __init__(self, e, descr='', detail=''):
         super(NoDBError, self).__init__(e, descr, detail)
 
 
-class NoUserError(Error):
+class NoUserError(SetupError):
     '''No user name supplied'''
     def __init__(self, e, descr='', detail=''):
         super(NoUserError, self).__init__(e, descr, detail)
 
 
-class AuthFailError(Error):
+class AuthFailError(SetupError):
     '''Unable to connect to the db'''
     def __init__(self, e, descr='', detail=''):
         super(AuthFailError, self).__init__(e, descr, detail)
 
 
-class DryRunError(Error):
+class DryRunError(SetupError):
     '''Rollback due to dry_run config option'''
     def __init__(self, e, descr='', detail=''):
         super(DryRunError, self).__init__(e, descr, detail)
 
 
-class CSRFError(Error):
+class CSRFError(SetupError):
     '''Invalid CSRF token'''
     def __init__(self, e, descr='', detail=''):
         super(CSRFError, self).__init__(e, descr, detail)
 
 
-class NoHeadersError(Error):
+class NoHeadersError(SetupError):
     '''No column headings found'''
     def __init__(self, e, descr='', detail=''):
         super(NoHeadersError, self).__init__(e, descr, detail)
 
 
-class NoDataError(Error):
+class NoDataError(SetupError):
     '''No data uploaded'''
     def __init__(self, e, descr='', detail=''):
         super(NoDataError, self).__init__(e, descr, detail)
 
 
-class CantDecodeError(Error):
+class CantDecodeError(SetupError):
     '''Can't decode file data into unicode'''
     def __init__(self, e, descr='', detail=''):
         super().__init__(e, descr, detail)
 
 
-class DuplicateUploadError(Error):
+class DuplicateUploadError(SetupError):
     '''The same filename updated twice into the same db'''
     def __init__(self, e, descr='', detail=''):
         super(DuplicateUploadError, self).__init__(e, descr, detail)
 
 
-class DataInconsistencyError(Error):
+class DataInconsistencyError(SetupError):
     def __init__(self, e, descr='', detail=''):
         super(DataInconsistencyError, self).__init__(e, descr, detail)
 
 
-class DBError(Error):
+class DBError(SetupError):
     '''psycopg2 raised an error'''
     def __init__(self, pgexc, e='process your request'):
         '''