Skip to content

Commit

Permalink
Better error message for failing to evaluate setup code, fix #785. (#787
Browse files Browse the repository at this point in the history
)
  • Loading branch information
fredrikekre authored Aug 15, 2018
1 parent 1bc1d77 commit 34d4bb1
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/DocTests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,14 @@ function doctest(block::Markdown.Code, meta::Dict, doc::Documents.Document, page

for expr in [get(meta, :DocTestSetup, []); get(meta[:LocalDocTestArguments], :setup, [])]
Meta.isexpr(expr, :block) && (expr.head = :toplevel)
Core.eval(sandbox, expr)
try
Core.eval(sandbox, expr)
catch e
push!(doc.internal.errors, :doctest)
@error("could not evaluate expression from doctest setup.",
expression = expr, exception = e)
return false
end
end
if occursin(r"^julia> "m, block.code)
eval_repl(block, sandbox, meta, doc, page)
Expand Down

0 comments on commit 34d4bb1

Please sign in to comment.