From 5cca38e054c811cd90fe8c5f49b5f8a9a4d3f1f6 Mon Sep 17 00:00:00 2001 From: "Andrew Speciale (@liquidz00)" Date: Thu, 27 Jun 2024 13:12:22 -0400 Subject: [PATCH] Add PlistError class for first run functionality error handling --- src/exceptions.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/exceptions.py b/src/exceptions.py index 2f77db5..723458f 100644 --- a/src/exceptions.py +++ b/src/exceptions.py @@ -63,6 +63,22 @@ def __str__(self): return self.message +class PlistError(PatcherError): + """Raised when there is an error creating directories.""" + + def __init__(self, message="Unable to interact with plist!", path=None): + self.path = path + if path: + message = f"{message} - Path: {path}" + super().__init__(message) + self.message = message + + def __str__(self): + if self.path: + return f"{self.message} - Path: {self.path}" + return self.message + + class ExportError(PatcherError): """Raised when encountering error(s) exporting data to files.""" @@ -222,7 +238,8 @@ def error_handling(log: LogMe, stop_event: Event): DeviceOSFetchError, SortError, SofaFeedError, - APIPrivilegeError + APIPrivilegeError, + PlistError ) try: yield