Errors

Term.Errors.add_new_module_name!Method
add_new_module_name!(content, ctx::StacktraceContext, curr_modul)

When a frame belonging to a module different from the previous one is shown, print the new module's name.

source
Term.Errors.add_number_frames_skipped!Method
add_number_frames_skipped!(content, ctx, to_skip, num, bt, n_skipped, skipped_frames_modules)

Add some text explaining how many frames were skipped from the stacktrace visualization and to which modules they belonged.

source
Term.Errors.add_stack_frame!Method
add_stack_frame!(frame::StackFrame, ctx::StacktraceContext, num::Int;  kwargs...)

Renders a panel with:

  • frame number
  • function name/signature
  • source code at error line
source
Term.Errors.install_term_stacktraceMethod
install_term_stacktrace(; reverse_backtrace::Bool = true, max_n_frames::Int = 30)

Replace the default Julia stacktrace error stacktrace printing with Term's.

Term parses a StackTrace adding additional info and style before printing it out to the user. The printed output consists of two parts: - a list of "frames": nested code points showing where the error occurred, the "Error Stack" - a message: generally the standard info message given by Julia but with addintional formatting option.

Several options are provided to reverse the order in which the frames are shown (compared to Julia's default ordering), hide extra frames when a large number is in the trace (e.g. Stack Overflow error) and hide Base and standard libraries error information (i.e. when a frame is in a module belonging to those.)

source
Term.Errors.render_backtraceMethod
render_backtrace(bt::Vector; reverse_backtrace = true, max_n_frames = 30)

Main error backtrace rendering function. It renders each frame in a stacktrace after some filtering (e.g. to hide frames in BASE). It takes care of hiding frames when there's a large number of them.

source
Term.Errors.render_error_code_lineMethod
render_error_code_line(frame::StackFrame; δ=2)

Create a Panel showing formatted Julia code for a frame's error line. The parameter δ speciies how many lines above/below the error line to show.

source