FCP-INDI / C-PAC

Configurable Pipeline for the Analysis of Connectomes
https://fcp-indi.github.io/
GNU Lesser General Public License v3.0
61 stars 39 forks source link

♻️ Replace `logger.error; sys.exit` pattern with `raise SpecificException` pattern #2105

Open shnizzedy opened 2 months ago

shnizzedy commented 2 months ago

Where I came upon the pattern:

print(error_message)
sys.exit(exitcode)

, I wasn't consistent. Mostly I updated to something like:

logger.error(error_message)
sys.exit(exitcode)

but sometimes I did like:

raise Exception(error_message)

(but with a more specific error class than Exception). I think we generally want to convert all the sys.exits to raise Exceptions, but this PR's already uncomfortably large without doing so. I think that can be a subsequent PR if we care to.

Originally posted by @shnizzedy in https://github.com/FCP-INDI/C-PAC/pull/2062#pullrequestreview-1886318775