Обработка исключений

def method_with_exception():
    try:
        raise Exception("test exception")
    except Exception as ex:
        # implementation of any partial processing
        # and send error to the calling code
        raise ex


try:
    method_with_exception()
except Exception as e:
    print(e.args[0])