Module bcder::debug[][src]

Expand description

Macros for last-resort debugging.

Note: This facility is going to be replaced by an error type that includes a backtrace of the extra-debug feature is set.

Since error reporting of the BER parser is limited on purpose, debugging code using it may be difficult. To remedy this somewhat, this module contains a macro xerr!() that will print out a backtrace if the extra-debug feature is enable during build before resolving into whatever the expression it encloses resolves to otherwise. Use it whenever you initially produce an error, i.e.:

if foo {
    xerr!(Err(Error::Malformed))
}

or, with an early return:

if foo {
    xerr!(return Err(Error::Malformed));
}