From 390bb66ba8fe06d431a78e3147a2a1c14b1e563c Mon Sep 17 00:00:00 2001 From: Kristoffer Carlsson Date: Wed, 6 Mar 2019 14:49:43 +0100 Subject: [PATCH] Revert "only break if we are throwing an uncaught exception (#89)" (#109) This reverts commit 28af3b350bb2f6ab427e55e8cadbe539a5ef5a5e. --- src/interpret.jl | 10 ++++------ test/breakpoints.jl | 4 ---- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/interpret.jl b/src/interpret.jl index fe9e720f3d694..8132e7af3d900 100644 --- a/src/interpret.jl +++ b/src/interpret.jl @@ -488,11 +488,6 @@ function step_expr!(stack, frame, istoplevel::Bool=false) end function handle_err(stack, frame, pc, err) - if !isempty(frame.exception_frames) - # Exception caught - frame.last_exception[] = err - return JuliaProgramCounter(frame.exception_frames[end]) - end if break_on_error[] frame.pc[] = pc push!(stack, frame) @@ -506,9 +501,12 @@ function handle_err(stack, frame, pc, err) hasmethod(err.f, arg_types) && !hasmethod(err.f, arg_types, world = err.world)) @warn "likely failure to return to toplevel, try JuliaInterpreter.split_expressions" + rethrow(err) end end - rethrow(err) + isempty(frame.exception_frames) && rethrow(err) + frame.last_exception[] = err + return JuliaProgramCounter(frame.exception_frames[end]) end """ diff --git a/test/breakpoints.jl b/test/breakpoints.jl index 38e0a15ab7d9a..337dda37e365c 100644 --- a/test/breakpoints.jl +++ b/test/breakpoints.jl @@ -92,10 +92,6 @@ end @test length(stack) >= 2 @test stack[1].code.scope.name == :outer @test stack[2].code.scope.name == :inner - - f_catch() = try error(); catch; return 2; end - @test @interpret f_catch() == 2 - finally JuliaInterpreter.break_on_error[] = false end