From 7454432990b41c48904a2672fa7979cf1d686b97 Mon Sep 17 00:00:00 2001 From: Tim Holy Date: Wed, 13 Mar 2019 13:09:17 -0500 Subject: [PATCH] Enclose signatures_at in try/catch (fixes #132) --- src/breakpoints.jl | 9 +++++++-- test/breakpoints.jl | 7 +++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/breakpoints.jl b/src/breakpoints.jl index e07c781cedabbe..02176e83508cac 100644 --- a/src/breakpoints.jl +++ b/src/breakpoints.jl @@ -203,10 +203,15 @@ end Set a breakpoint at the specified file and line number. """ function breakpoint(filename::AbstractString, line::Integer, args...) - sigs = signatures_at(filename, line) + local sigs + try + sigs = signatures_at(filename, line) + catch + sigs = nothing + end if sigs === nothing # TODO: build a Revise-free fallback. Note this won't work well for methods with keywords. - error("no signatures found at $filename, $line. Restarting and `using Revise` may fix this problem.") + error("no signatures found at $filename, $line.\nRestarting and `using Revise` and the relevant package may fix this problem.") end for sig in sigs method = JuliaInterpreter.whichtt(sig) diff --git a/test/breakpoints.jl b/test/breakpoints.jl index 8dce1ae8c83034..01fb7b3ada9df3 100644 --- a/test/breakpoints.jl +++ b/test/breakpoints.jl @@ -110,6 +110,13 @@ end var = JuliaInterpreter.locals(leaf(frame)) @test !any(v->v.name == :b, var) @test filter(v->v.name == :a, var)[1].value == 2 + else + try + breakpoint(pathof(JuliaInterpreter.CodeTracking), 5) + catch err + @test isa(err, ErrorException) + @test occursin("Revise", err.msg) + end end # Direct return