Skip to content

Commit 3bc5e15

Browse files
committed
Use @repl block instead of @example to show errors in documentation without workarounds
1 parent 755b3b6 commit 3bc5e15

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

docs/src/basics/Debugging.md

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,18 @@ sys = structural_simplify(sys)
1818

1919
This problem causes the ODE solver to crash:
2020

21-
```@example debug
22-
prob = ODEProblem(sys, [], (0.0, 10.0), [])
23-
sol = solve(prob, Tsit5())
21+
```@repl debug
22+
prob = ODEProblem(sys, [], (0.0, 10.0), []);
23+
sol = solve(prob, Tsit5());
2424
```
2525

2626
This suggests *that* something went wrong, but not exactly *what* went wrong and *where* it did.
2727
In such situations, the `debug_system` function is helpful:
2828

29-
```@example debug
30-
try # workaround to show Documenter.jl error (https://github.com/JuliaDocs/Documenter.jl/issues/1420#issuecomment-770539595) # hide
31-
dsys = debug_system(sys; functions = [sqrt])
32-
dprob = ODEProblem(dsys, [], (0.0, 10.0), [])
33-
dsol = solve(dprob, Tsit5())
34-
catch err # hide
35-
showerror(stderr, err) # hide
36-
end # hide
29+
```@repl debug
30+
dsys = debug_system(sys; functions = [sqrt]);
31+
dprob = ODEProblem(dsys, [], (0.0, 10.0), []);
32+
dsol = solve(dprob, Tsit5());
3733
```
3834

3935
Now we see that it crashed because `u1` decreased so much that it became negative and outside the domain of the `` function.

0 commit comments

Comments
 (0)