Error handling for enabling profiles with issues using the sudo scripts.

This commit is contained in:
SimplifiedPrivacy 2026-07-23 18:45:27 -04:00
parent 1633562325
commit b444ff9218
2 changed files with 16 additions and 0 deletions

View file

@ -10,6 +10,8 @@ from core.controllers.tickets.UseTicketController import (
) )
from core.models.session.SessionProfile import SessionProfile from core.models.session.SessionProfile import SessionProfile
from core.models.system.SystemProfile import SystemProfile from core.models.system.SystemProfile import SystemProfile
from core.models.Result import Result, ResultError
from core.errors.exceptions import SudoScript, MissingPreReqs
from core.Errors import ( from core.Errors import (
CommandNotFoundError, CommandNotFoundError,
EndpointVerificationError, EndpointVerificationError,
@ -114,6 +116,10 @@ class Worker(QObject):
"PROFILE_STATE_CONFLICT_ERROR", False, self.profile_data['id'], None, None) "PROFILE_STATE_CONFLICT_ERROR", False, self.profile_data['id'], None, None)
except CommandNotFoundError as e: except CommandNotFoundError as e:
self.update_signal.emit(str(e.subject), False, -1, None, None) self.update_signal.emit(str(e.subject), False, -1, None, None)
except SudoScript as e:
self.update_signal.emit(str(e), False, None, None, None)
except MissingPreReqs as e:
self.update_signal.emit(str(e), False, None, None, None)
except Exception as e: except Exception as e:
print(e) print(e)
self.update_signal.emit( self.update_signal.emit(

View file

@ -16,6 +16,8 @@ from core.models.session.SessionProfile import SessionProfile
from core.models.system.SystemConnection import SystemConnection from core.models.system.SystemConnection import SystemConnection
from core.models.BaseProfile import ProfileType from core.models.BaseProfile import ProfileType
from core.models.system.SystemProfile import SystemProfile from core.models.system.SystemProfile import SystemProfile
from core.errors.exceptions import SudoScript, MissingPreReqs
from core.models.Result import Result, ResultError
from gui.v2.infrastructure.setup_observers import ( from gui.v2.infrastructure.setup_observers import (
client_observer, client_observer,
@ -133,6 +135,10 @@ class WorkerThread(QThread):
ProfileController.disable( ProfileController.disable(
profile, ignore=True, profile_observer=profile_observer) profile, ignore=True, profile_observer=profile_observer)
self.text_output.emit("All profiles were successfully disabled") self.text_output.emit("All profiles were successfully disabled")
# except SudoScript as e:
# self.text_output.emit(e)
# except MissingPreReqs as e:
# self.text_output.emit(e)
except Exception: except Exception:
self.text_output.emit("An error occurred when disabling profile") self.text_output.emit("An error occurred when disabling profile")
finally: finally:
@ -229,6 +235,10 @@ class WorkerThread(QThread):
else: else:
self.text_output.emit( self.text_output.emit(
f"No profile found with ID: {self.profile_data['id']}") f"No profile found with ID: {self.profile_data['id']}")
# except SudoScript as e:
# self.text_output.emit(str(e))
# except MissingPreReqs as e:
# self.text_output.emit(str(e))
except Exception as e: except Exception as e:
self.text_output.emit("An error occurred when disabling profile") self.text_output.emit("An error occurred when disabling profile")
finally: finally: