So I wrote this little unknown Python utility in 2016 to make it easier to use custom exceptions to abort a script instead of littering sys.exit() around. https://github.com/datagrok/python-userexit
One little feature I just added: if I don't specify an exit status with the message, pick one I haven't used, automatically.
What a rabbit-hole! Since exceptions are classes and I didn't want to use a class decorator, I needed a metaclass to make this happen!
https://github.com/datagrok/python-userexit/blob/master/userexit.py#L83L102
Longer-form blog post coming eventually.