I am trying to catch an exception that is not raised, just logged. Is there any way to do this?
def exampleFunction():
try:
x = 1 / 0
except Exception:
logging.exception('divide by 0 error here.')
try:
exampleFunction()
except <condition based on if logging.exception was called>
print('there was a divide by 0 error when I called exampleFunction()')
exampleFunctionsilently swallow that exception?mock. Let me thing...exampleFunctionjust swallows the exception so it doesn't break any code that calls it by throwing a random exception (thinks the issue is minor/skippable). But in my specific case, I need to treat it as an exceptionexampleFunction?