Macro peel_ip::prelude::fix_error []

macro_rules! fix_error {
    ( $ i : expr , $ t : ty , $ submac : ident ! ( $ ( $ args : tt ) * ) ) => { ... };
    ( $ i : expr , $ t : ty , $ f : expr ) => { ... };
}

translate parser result from IResult to IResult with a custom type

    // will add a Custom(42) error to the error chain
    named!(err_test, add_return_error!(ErrorKind::Custom(42), tag!("abcd")));
    // Convert to IREsult<&[u8], &[u8], &str>
    named!(parser<&[u8], &[u8], &str>, add_return_error!(ErrorKind::Custom("custom error message"), fix_error!(&str, err_test)));

    let a = &b"efghblah"[..];
    let res_a = parser(a);
    assert_eq!(res_a,  Error(NodePosition( ErrorKind::Custom("custom error message"), a, Box::new(Position(ErrorKind::Fix, a)))));