From 7cf8afd3ae34e14157196d5413916a57a2658c43 Mon Sep 17 00:00:00 2001 From: "Karl O. Pinc" Date: Fri, 25 Dec 2020 15:01:47 -0600 Subject: [PATCH] Allow exception error descriptions to be extended --- src/pgwui_core/exceptions.py | 10 ++++++++++ 1 file changed, 10 insertions(+) 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): ''' -- 2.34.1