# Karl O. Pinc <kop@karlpinc.com>
from pgwui_core import exceptions as core_ex
+# PGWUI setting related exceptions
+from pgwui_core.exceptions import SetupError
# Line-by-line processing errors
f'The error is: {exp}')
-# PGWUI setting related exceptions
-
-class Error(core_ex.Error):
- pass
-
-
# Exceptions that require detail
-class NotAZipfileError(Error):
+class NotAZipfileError(SetupError):
def __init__(self, filename):
super().__init__(
'No zip file uploaded',
f'The uploaded file ({filename}) is not recognized as a zip file')
-class CannotUnarchiveError(Error):
+class CannotUnarchiveError(SetupError):
def __init__(self, filename, err):
super().__init__(
'Cannot unzip',
'the error reported is: err'))
-class NotADirectoryError(Error):
+class NotADirectoryError(SetupError):
def __init__(self, filename, name):
super().__init__(
'Not a directory',
'The entries at the top of the zip file must be directories')
-class EmptyArchiveError(Error):
+class EmptyArchiveError(SetupError):
def __init__(self, filename, err):
super().__init__(
'Empty zip file',
f'The uploaded file ({filename}) has no content')
-class NotAFileError(Error):
+class NotAFileError(SetupError):
def __init__(self, filename, name):
super().__init__(
'Not a file',
'The directories in the zip file may only contain files')
-class NoMapfileError(Error):
+class NoMapfileError(SetupError):
def __init__(self, filename, map_file):
super().__init__(
'Missing map file',
'maps file names to table names')
-class CannotReadError(Error):
+class CannotReadError(SetupError):
def __init__(self, filename, exp):
super().__init__(
f'Cannot open ({filename}) for reading',
f'The error is: {exp}')
-class CannotRollbackError(Error):
+class CannotRollbackError(SetupError):
def __init__(self, exp):
super().__init__(
'Cannot roll back the current transaction',
f'The error from psycopg2 is: ({exp})')
-class BadMapFileError(Error):
+class BadMapFileError(SetupError):
pass
<%!
from pgwui_upload_core.template_utils import show_choice
from pgwui_common.path import asset_abspath
- import pgwui_core.exceptions as core_ex
+ import pgwui_common.exceptions as common_ex
upload_base_mak = asset_abspath('pgwui_upload_core:templates/upload.mak')
%>
last_filepath = None
f_errors = []
for error in errors:
- if isinstance(error, core_ex.UploadError):
+ if isinstance(error, common_ex.UploadError):
if error.filepath != last_filepath:
if last_filepath:
self.file_errors(f_errors, last_filepath, firsterr)