@@ -94,6 +94,52 @@ combinations or that you want to break on entry to *any* method of a particular
94
94
At present, note that some of this functionality requires that you be running
95
95
[ Revise.jl] ( https://github.com/timholy/Revise.jl ) .
96
96
97
+ It is, in addition, possible to halt execution when otherwise an error would be thrown.
98
+ This functionality is enabled using [ ` break_on ` ] ( @ref ) and disabled with [ ` break_off ` ] ( @ref ) :
99
+
100
+ ``` jldoctest demo1
101
+ julia> function f_outer()
102
+ println("before error")
103
+ f_inner()
104
+ println("after error")
105
+ end;
106
+
107
+ julia> f_inner() = error("inner error");
108
+
109
+ julia> break_on(:error)
110
+
111
+ julia> fr, pc = @interpret f_outer()
112
+ before error
113
+ (Frame for f_outer() in Main at none:2
114
+ 1 2 1 ─ (println)("before error")
115
+ 2* 3 │ (f_inner)()
116
+ 3 4 │ %3 = (println)("after error")
117
+ 4 4 └── return %3
118
+ callee: f_inner() in Main at none:1, breakpoint(error(s::AbstractString) in Base at error.jl:33, line 33, ErrorException("inner error")))
119
+
120
+ julia> leaf(fr)
121
+ Frame for error(s::AbstractString) in Base at error.jl:33
122
+ 1 33 1 ─ %1 = (ErrorException)(s)
123
+ 2* 33 │ %2 = (throw)(%1)
124
+ 3 33 └── return %2
125
+ s = "inner error"
126
+ caller: f_inner() in Main at none:1
127
+
128
+ julia> typeof(pc)
129
+ BreakpointRef
130
+
131
+ julia> pc.err
132
+ ErrorException("inner error")
133
+
134
+ julia> break_off(:error)
135
+
136
+ julia> @interpret f_outer()
137
+ before error
138
+ ERROR: inner error
139
+ Stacktrace:
140
+ [...]
141
+ ```
142
+
97
143
Finally, you can set breakpoints using [ ` @bp ` ] ( @ref ) :
98
144
99
145
``` jldoctest demo1
0 commit comments