diff --git a/src/commands.jl b/src/commands.jl index 8dfb69ad99496..69fd00d80ebbc 100644 --- a/src/commands.jl +++ b/src/commands.jl @@ -28,6 +28,7 @@ end function propagate_exception!(state, exc) while !isempty(state.stack) shift!(state.stack) + isempty(state.stack) && break if isa(state.stack[1], JuliaStackFrame) if !isempty(state.stack[1].exception_frames) # Exception caught @@ -148,7 +149,7 @@ function DebuggerFramework.execute_command(state, frame::JuliaStackFrame, ::Val{ ct = Base.code_typed(f, Base.typesof(args[2:end]...)) ct = ct == 1 ? ct[1] : ct println(ct) - end + end end return false end diff --git a/test/stepping.jl b/test/stepping.jl index ae0f8b422170d..1c7b1907312bf 100644 --- a/test/stepping.jl +++ b/test/stepping.jl @@ -193,4 +193,17 @@ state = dummy_state(stack) execute_command(state, state.stack[1], Val{:n}(), "nc") execute_command(state, state.stack[1], Val{:n}(), "nc") @assert isempty(state.stack) -@assert state.overall_result == 6 \ No newline at end of file +@assert state.overall_result == 6 + +# Test that we throw the right error when stepping through error functions +function foo_error(a,b) + a > b && error() + return a*b +end +stack = @make_stack foo_error(3,1) +state = dummy_state(stack) +try + execute_command(state, state.stack[1], Val{:n}(), "n") +catch e + @assert isa(e, ErrorException) +end \ No newline at end of file