[][src]Function artichoke::backtrace::format_repl_trace_into

pub fn format_repl_trace_into<W, E>(
    error: W,
    interp: &mut Artichoke,
    exc: &E
) -> Result<(), Box<dyn Error>> where
    W: Write + WriteColor,
    E: RubyException

Format an Exception backtrace into an io::Write suitable for displaying in a Ruby REPL.

This backtrace has the same style and formatting as one returned from the irb command in MRI.

Examples

Executing the following Ruby code:

def fail; raise RuntimeError, "bang!"; end
fail

Results in this stacktrace:

Traceback (most recent call last):
    2: from (airb):2
    1: from (airb):1:in fail
RuntimeError (bang!)

Errors

If writing into the provided out writer fails, an error is returned.