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 the FileNotFoundError, then “The above exception was the direct
cause of the following exception:”, then the ExportMissingError. Even without from, Python
keeps the first error as __context__, joined by “During handling of the above exception, another
exception occurred:”.
In the JavaScript port, readExport() awaits readFile() inside try, so it’s an async
function, and its catch checks err.code for "ENOENT" (“error, no entry”: no such file).
JavaScript has no from, so the natural port leaves it out, and an uncaught call from a two-line
script shows no sign of the ENOENT error: