AbbreviatedStackTraces.jl

Author BioTurboNick
Popularity
20 Stars
Updated Last
25 Days Ago
Started In
April 2021

AbbreviatedStackTraces.jl

The goal of this is to demonstrate an improvement to the display of stack traces in the Julia REPL, associated with this PR: https://github.com/JuliaLang/julia/pull/40537

Chaining packages together, or particularly complex packages, can produce some nasty stack traces that fill the screen. This is a barrier to entry using Julia and can get in the way generally.

Here's an example of a stack trace by chaining BenchmarkTools and Plots:

]add https://github.com/BioTurboNick/AbbreviatedStackTraces.jl # to install (not in registry)
using AbbreviatedStackTraces # over-writes error-related `Base` methods
using BenchmarkTools, Plots
@btime plot([1,2,3], seriestype=:blah)

image

It aims to find the stack frames of code you don't control and excludes them by default, except for the first frame into that package. In it's place, it lists the modules called in the intervening frames. The theory is that errors in your code are much more likely than errors inside Base, the Stdlibs, or published packages, so their internals are usually superfluous.

image

The global err variable stores the last error and can show the full, original stack trace easily.

There is an optional minimal display available, accessed by setting ENV["JULIA_STACKTRACE_MINIMAL"] = true. image