While I know I should use debuggers more often, I would simply try to print the last datum since it should still be in memory if you are in an interactive environment.
Alt. you could implement a try-except condition and print the info in the except part if the error occurs
E.g., sth like
try:
    ...
except RuntimeError:
    print the necessary info