-# Copyright (C) 2020 The Meme Factory, Inc. http://www.karlpinc.com/
+# Copyright (C) 2020, 2024 The Meme Factory, Inc. http://www.karlpinc.com/
# This file is part of ${component}.
#
from pgwui_core import exceptions as core_ex
-# PGWUI setting related exceptions
+# PGWUI setting and user-supplied value related exceptions
-class Error(common_ex.SetupError):
+class ExampleSetupError(common_ex.SetupError):
pass
-class ExampleOnOffAskError(SetupError):
+class ExampleOnOffAskError(ExampleSetupError):
def __init__(self, value):
super().__init__(
- 'The "pgwui:${component}:example_on_off_ask" PGWUI setting '
- ' must be "on", "off", "ask", or not present')
+ ('The "pgwui:${component}:example_on_off_ask" PGWUI setting '
+ ' must be "on", "off", "ask", or not present'),
+ descr=f'Got: ({value})')
-class ExampleDetailedError(SetupError):
+
+class ExampleDetailedError(ExampleSetupError):
def __init__(self, e, descr='', detail=''):
super().__init__('Detailed error', descr=descr, detail=detail)
+
+
+# Data error related exception
+
+class ExampleTooManyRowsError(core_ex.DataLineError):
+ '''
+ Module exception rasied while line-by-line processing the uploaded
+ data.
+
+ lineno The line number
+ e The error message
+ descr More description of the error
+ detail Extra HTML describing the error
+ data The uploaded data
+ '''
+ def __init__(self, lineno, e, descr='', detail='', data=''):
+ if descr is None:
+ descr = 'Too many rows of uploaded data'
+ super().__init__(e, lineno, descr, detail, data)