SyntaxStudy
Sign Up
Python Intermediate 3 min read

Re-raising Exceptions

Re-raising Exceptions

Use bare raise inside an except block to re-raise the current exception after logging or partial handling.

Example
def process():
    try:
        risky_operation()
    except Exception as e:
        log_error(e)
        raise   # re-raise original exception
Pro Tip

Bare raise preserves the original traceback; raise e does not.