Function panic_context::panic_context
[−]
[src]
pub fn panic_context(prefix: &'static str) -> UpdatablePanicContext
Creates panic context whose message may be updated.
prefix
string will be prepended to each value provided to
update
method.
Usage
Bind panic context and use update
method to update message.
Message is automatically removed when panic context goes out
of scope.
Example
let step = panic_context("step: "); step.update("calculate lengths"); // ... step.update("calculate signatures"); // ... panic!("boom!");
Result:
Panic context:
step: calculate signatures
thread 'main' panicked at '...', src/libcore/str/mod.rs:2162
note: Run with `RUST_BACKTRACE=1` for a backtrace.