From 37e0ce53d0e8903326c8fcd095b44b9ef78492cd Mon Sep 17 00:00:00 2001 From: Morten Piibeleht Date: Mon, 15 Mar 2021 10:26:22 +1300 Subject: [PATCH] Update docstrings --- src/Literate.jl | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Literate.jl b/src/Literate.jl index 1111b45..1ffdc79 100644 --- a/src/Literate.jl +++ b/src/Literate.jl @@ -706,14 +706,16 @@ function execute_block(sb::Module, block::String) # Push a capturing display on the displaystack disp = LiterateDisplay() pushdisplay(disp) - # r is the result - # status = (true|false) - # _: backtrace - # str combined stdout, stderr output - c = IOCapture.capture(rethrow = InterruptException) do + # We use the following fields of the object returned by IOCapture.capture: + # - c.value: return value of the do-block (or the error object, if it throws) + # - c.error: set to `true` if the do-block throws an error + # - c.output: combined stdout and stderr + # `rethrow = Union{}` means that we try-catch all the exceptions thrown in the do-block + # and return them via the return value (they get handled below). + c = IOCapture.capture(rethrow = Union{}) do include_string(sb, block) end - popdisplay(disp) # Documenter.withoutput has a try-catch so should always end up here + popdisplay(disp) # IOCapture.capture has a try-catch so should always end up here if c.error error(""" $(sprint(showerror, c.value))