Skip to content

Commit 9d70f9f

Browse files
committed
Don't quit the debugger if there's errors during printing
1 parent c62e473 commit 9d70f9f

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/DebuggerFramework.jl

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,13 @@ module DebuggerFramework
1717
else
1818
val = get(val)
1919
T = typeof(val)
20-
val = repr(val)
21-
if length(val) > 150
22-
val = Suppressed("$(length(val)) bytes of output")
20+
try
21+
val = repr(val)
22+
if length(val) > 150
23+
val = Suppressed("$(length(val)) bytes of output")
24+
end
25+
catch
26+
val = Suppressed("printing error")
2327
end
2428
println(io, name, "::", T, " = ", val)
2529
end
@@ -155,7 +159,7 @@ module DebuggerFramework
155159
current_line = line
156160
stoplinelength = length(string(stopline))
157161

158-
code = split(code[(startoffset:stopoffset).+1],'\n')
162+
code = split(code[broadcast(+, startoffset:stopoffset, 1)],'\n')
159163
lineno = startline
160164

161165
if !isempty(code) && isempty(code[end])
@@ -239,6 +243,10 @@ module DebuggerFramework
239243
prompt_suffix=Base.text_colors[:white],
240244
on_enter = s->true)
241245

246+
# 0.7 compat
247+
if isdefined(panel, :repl)
248+
panel.repl = repl
249+
end
242250
panel.hist = REPL.REPLHistoryProvider(Dict{Symbol,Any}(:debug => panel))
243251
Base.REPL.history_reset_state(panel.hist)
244252

0 commit comments

Comments
 (0)