Skip to content

Commit

Permalink
Hard-fail if improper settings are detected (#9)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>

---------

Co-authored-by: Ron <[email protected]>
  • Loading branch information
mastacheata and GitRon authored Oct 11, 2023
1 parent 7c17361 commit 7216d60
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ambient_toolbox/services/custom_scrubber.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
from django.db import connections


class ScrubbingError(RuntimeError):
pass


class AbstractScrubbingService:
DEFAULT_USER_PASSWORD = 'Admin0404!'

Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 7216d60

Please sign in to comment.