Skip to content

Commit

Permalink
Fix error throwing at top level
Browse files Browse the repository at this point in the history
Fixes #8
  • Loading branch information
Keno committed Nov 16, 2017
1 parent 695afa7 commit fe52dfd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/commands.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
15 changes: 14 additions & 1 deletion test/stepping.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
@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

0 comments on commit fe52dfd

Please sign in to comment.