Skip to content

Commit 14acbbd

Browse files
authored
Link FAQ from error message (#108)
1 parent 2897cfb commit 14acbbd

File tree

2 files changed

+5
-15
lines changed

2 files changed

+5
-15
lines changed

src/checkboxes.jl

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -134,22 +134,12 @@ function Base.showerror(io::IO, err::HasBoxedVariableError)
134134
end
135135

136136
println(io)
137-
printstyled(io, "HINT:", bold = true, color = :magenta)
138-
var = get(varnames, 1, :x)
139-
print(io, " Consider adding declarations such as `")
140-
printstyled(io, "local ", var; color = :cyan)
141-
print(io, "` at the narrowest possible scope required.")
142-
143-
println(io)
144-
printstyled(io, "NOTE:", bold = true, color = :light_black)
137+
print(io, "See: ")
145138
printstyled(
146139
io,
147-
" This is very likely required for avoiding data races.",
148-
" If boxing the variables is intended, use `Ref{Any}(...)`",
149-
" instead.";
150-
color = :light_black,
140+
"https://juliafolds.github.io/FLoops.jl/dev/explanation/faq/#avoid-boxing";
141+
color = :blue,
151142
)
152-
# "To ignore this error, pass `allow_boxing = Val(true)` to the executor."
153143

154144
println(io)
155145
printstyled(io, "NOTE:", bold = true, color = :light_black)

test/FLoopsTests/src/test_checkboxes.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,18 +80,18 @@ function test_HasBoxedVariableError()
8080
err = HasBoxedVariableError(_make_closure_with_a_box())
8181
@debug "Example `HasBoxedVariableError`" err
8282
msg = sprint(showerror, err)
83-
@test occursin("Consider adding declarations such as `local a`", msg)
8483
@test occursin("1 boxed variable:", msg)
8584
@test occursin(r"\b a \b"x, msg)
85+
@test occursin("faq/#avoid-boxing", msg)
8686
end
8787
@testset "two boxes" begin
8888
err = HasBoxedVariableError(_make_closure_with_two_boxes())
8989
@debug "Example `HasBoxedVariableError`" err
9090
msg = sprint(showerror, err)
91-
@test occursin(r"Consider adding declarations such as `local (a|b)`", msg)
9291
@test occursin("2 boxed variables:", msg)
9392
@test occursin(r"\b a \b"x, msg)
9493
@test occursin(r"\b b \b"x, msg)
94+
@test occursin("faq/#avoid-boxing", msg)
9595
end
9696
end
9797

0 commit comments

Comments
 (0)