Keeping the Original Error With cause
Joan’s December export still doesn’t exist. In Python, read_export() turns the missing file into
the program’s own error, and main() prints the original, err.__cause__, on the report’s second
line:
except FileNotFoundError as err:
raise ExportMissingError(f"no export at {path}") from err
Uncaught, the traceback shows both errors, joined by “The above exception was the direct cause of
the following exception:”. Python keeps both, with from or without it.
In the JavaScript port, readExport() is async to await readFile(), and its catch checks
err.code for "ENOENT" (“error, no entry”: no such file). JavaScript has no from, so the raise
line ports without it. Called uncaught from a two-line script, it crashes with no sign of the
ENOENT error: