erreurs critiques python

import logging

class ExitOnExceptionHandler(logging.StreamHandler):
    def emit(self, record):
        super().emit(record)
        if record.levelno in (logging.ERROR, logging.CRITICAL):
            raise SystemExit(-1)


logging.basicConfig(handlers=[ExitOnExceptionHandler()], level=logging.DEBUG)

logger = logging.getLogger('MYTHING')

def causeAProblem():
    try:
        raise ValueError("Oh no!")
    except Exception as e:
        logger.exception(e)

logger.warning('Going to try something risky...')
causeAProblem()
print("This won't get printed")
Ugly Unicorn