Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Fix stacktraces on 1.3 #242

Open
pfitzseb opened this issue Feb 25, 2019 · 7 comments
Open

[BUG] Fix stacktraces on 1.3 #242

pfitzseb opened this issue Feb 25, 2019 · 7 comments
Labels

Comments

@pfitzseb
Copy link
Member

No description provided.

@pfitzseb pfitzseb added the bug label Feb 25, 2019
@MikeInnes
Copy link
Member

1.2 is fairly imminent, so it'd be great to get a fix for this is soon.

@pfitzseb
Copy link
Member Author

pfitzseb commented May 1, 2019

Will fix this tomorrow.

@c42f
Copy link

c42f commented May 3, 2019

I'd suggest that for Juno you should report the entire exception stack in a similar way to Base.show_exception_stack().

This should be an improvement regardless of how we end up fixing JuliaLang/julia#31830

@pfitzseb
Copy link
Member Author

pfitzseb commented May 3, 2019

That'd be very different from the REPL, no? Or is the default backtrace printing going to change as well?

Code:

function f(x)
    try
        x//x
    catch err
        throw(ErrorException("haha"))
    end
end
g(x) = f(x)

REPL:

julia> g(0)
ERROR: haha
Stacktrace:
 [1] f(::Int64) at ./untitled-7af6d0839891b2927dcc55b4483b0fe7:10
 [2] g(::Int64) at ./untitled-7af6d0839891b2927dcc55b4483b0fe7:13
 [3] top-level scope at none:0

Base.show_exception_stack():

caused by [exception 2]
haha
Stacktrace:
 [1] f(::Int64) at ./untitled-7af6d0839891b2927dcc55b4483b0fe7:10
 [2] g(::Int64) at ./untitled-7af6d0839891b2927dcc55b4483b0fe7:13
 [3] top-level scope at untitled-7af6d0839891b2927dcc55b4483b0fe7:14
caused by [exception 1]
ArgumentError: invalid rational: zero(Int64)//zero(Int64)
Stacktrace:
 [1] __throw_rational_argerror(::Type) at ./rational.jl:18
 [2] Type at ./rational.jl:13 [inlined]
 [3] Type at ./rational.jl:20 [inlined]
 [4] // at ./rational.jl:43 [inlined]
 [5] f(::Int64) at ./untitled-7af6d0839891b2927dcc55b4483b0fe7:8
 [6] g(::Int64) at ./untitled-7af6d0839891b2927dcc55b4483b0fe7:13
 [7] top-level scope at untitled-7af6d0839891b2927dcc55b4483b0fe7:14

I suppose we could inject the error messages further down the stack into our normal backtrace printing though, so it'd look like:

ArgumentError: invalid rational: zero(Int64)//zero(Int64)
 [1] __throw_rational_argerror(::Type) at ./rational.jl:18
 [2] Type at ./rational.jl:13 [inlined]
 [3] Type at ./rational.jl:20 [inlined]
 [4] // at ./rational.jl:43 [inlined]
haha
 [5] f(::Int64) at ./untitled-7af6d0839891b2927dcc55b4483b0fe7:8
 [6] g(::Int64) at ./untitled-7af6d0839891b2927dcc55b4483b0fe7:13
 [7] top-level scope at untitled-7af6d0839891b2927dcc55b4483b0fe7:14

@c42f
Copy link

c42f commented May 3, 2019

This is the printing in 1.3-DEV currently:

julia> g(0)
ERROR: haha
Stacktrace:
 [1] f(::Int64) at ./REPL[1]:5
 [2] g(::Int64) at ./REPL[2]:1
 [3] top-level scope at REPL[3]:1
caused by [exception 1]
ArgumentError: invalid rational: zero(Int64)//zero(Int64)
Stacktrace:
 [1] __throw_rational_argerror(::Type) at ./rational.jl:18
 [2] Type at ./rational.jl:13 [inlined]
 [3] Type at ./rational.jl:20 [inlined]
 [4] // at ./rational.jl:43 [inlined]
 [5] f(::Int64) at ./REPL[1]:3
 [6] g(::Int64) at ./REPL[2]:1
 [7] top-level scope at REPL[3]:1

@c42f
Copy link

c42f commented May 3, 2019

See JuliaLang/julia#30900.

Whether the root cause is printed first or last is a matter of taste. I kind of liked the root cause last so you don't have to go hunting for it by scrolling up too much.

@pfitzseb pfitzseb changed the title [BUG] Fix stacktraces on 1.2 [BUG] Fix stacktraces on 1.3 May 30, 2019
@pfitzseb
Copy link
Member Author

Stacktraces work fine on 1.2-RC, so there's a bit of a grace period to fix this :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants