From 7216d60b2e5bb27a904f241f500099e597fba376 Mon Sep 17 00:00:00 2001 From: Benedikt Bauer Date: Wed, 11 Oct 2023 12:19:28 +0200 Subject: [PATCH] Hard-fail if improper settings are detected (#9) * Hard-fail if improper settings are detected returning False doesn't break any surrounding processes (the command still exits with code 0) Raise an Exception to make sure a process calling this will either fail or handle the Exception properly * fix typo in Scrubbing error message Co-authored-by: Ron --------- Co-authored-by: Ron --- ambient_toolbox/services/custom_scrubber.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ambient_toolbox/services/custom_scrubber.py b/ambient_toolbox/services/custom_scrubber.py index 494a46f..50b3dfd 100644 --- a/ambient_toolbox/services/custom_scrubber.py +++ b/ambient_toolbox/services/custom_scrubber.py @@ -8,6 +8,10 @@ from django.db import connections +class ScrubbingError(RuntimeError): + pass + + class AbstractScrubbingService: DEFAULT_USER_PASSWORD = 'Admin0404!' @@ -44,7 +48,7 @@ def process(self): self._logger.info('Validating setup...') if not self._validation(): self._logger.warning('Aborting process!') - return False + raise ScrubbingError('Scrubber settings validation failed') # Custom pre-scrubbing for name in self.pre_scrub_functions: