From: Karl O. Pinc Date: Fri, 25 Dec 2020 21:01:47 +0000 (-0600) Subject: Allow exception error descriptions to be extended X-Git-Url: https://papio.biology.duke.edu/gitweb/?a=commitdiff_plain;h=7cf8afd3ae34e14157196d5413916a57a2658c43;p=pgwui_core Allow exception error descriptions to be extended --- diff --git a/src/pgwui_core/exceptions.py b/src/pgwui_core/exceptions.py index dc89a4c..ea618ed 100644 --- a/src/pgwui_core/exceptions.py +++ b/src/pgwui_core/exceptions.py @@ -64,6 +64,8 @@ class UploadError(PGWUIError): self.descr = descr self.detail = detail self.data = data + self.filepath = None + self.relation = None def __str__(self): out = 'error ({0})'.format(self.e) @@ -77,6 +79,14 @@ class UploadError(PGWUIError): out = '{0}: data ({1})'.format(out, self.data) return out + def color(self, descr, filepath, relation): + '''Add a description to the exception's error and save filepath + and relation + ''' + self.e = f'{descr}: {self.e}' + self.filepath = filepath + self.relation = relation + class Error(UploadError): '''