Explicit Cause Chaining

class ConfigError(Exception):
    pass

def load():
    try:
        int("not a number")
    except ValueError as e:
        raise ConfigError("bad config") from e

load()

This crashes. Which best describes the traceback Python prints?

A

A TypeError is raised immediately, because raise ... from e requires e to be re-raised bare, not passed as a cause.

B

Two full tracebacks separated by The above exception was the direct cause of the following exception:, with the ValueError first and the ConfigError second, because raise ... from e explicitly sets ConfigError's __cause__ to e.

C

Only the ConfigError traceback prints: from e replaces the original ValueError, so it's never shown.

D

Two full tracebacks separated by During handling of the above exception, another exception occurred:, the same message Python uses whenever one exception is raised while another is being handled.