Skip to content

Commit 390bb66

Browse files
authored
Revert "only break if we are throwing an uncaught exception (#89)" (#109)
This reverts commit 28af3b3.
1 parent d852de8 commit 390bb66

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

src/interpret.jl

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -488,11 +488,6 @@ function step_expr!(stack, frame, istoplevel::Bool=false)
488488
end
489489

490490
function handle_err(stack, frame, pc, err)
491-
if !isempty(frame.exception_frames)
492-
# Exception caught
493-
frame.last_exception[] = err
494-
return JuliaProgramCounter(frame.exception_frames[end])
495-
end
496491
if break_on_error[]
497492
frame.pc[] = pc
498493
push!(stack, frame)
@@ -506,9 +501,12 @@ function handle_err(stack, frame, pc, err)
506501
hasmethod(err.f, arg_types) &&
507502
!hasmethod(err.f, arg_types, world = err.world))
508503
@warn "likely failure to return to toplevel, try JuliaInterpreter.split_expressions"
504+
rethrow(err)
509505
end
510506
end
511-
rethrow(err)
507+
isempty(frame.exception_frames) && rethrow(err)
508+
frame.last_exception[] = err
509+
return JuliaProgramCounter(frame.exception_frames[end])
512510
end
513511

514512
"""

test/breakpoints.jl

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,6 @@ end
9292
@test length(stack) >= 2
9393
@test stack[1].code.scope.name == :outer
9494
@test stack[2].code.scope.name == :inner
95-
96-
f_catch() = try error(); catch; return 2; end
97-
@test @interpret f_catch() == 2
98-
9995
finally
10096
JuliaInterpreter.break_on_error[] = false
10197
end

0 commit comments

Comments
 (0)