3
Vote

"Include caught as inner" fails if inner is not last argument

description

Consider:
catch (Exception e)
{
    throw new OuterException(e, "Foo");
}
Here Exceptional suggests CA "Include caught exception as inner exception" which incorrectly appends x to the end of the argument list:
    throw new OuterException(e, "Foo", e); // won't compile
Perhaps OuterException doesn't follow the standard convention, but in my particular case it cannot be avoided.

comments

jpickwell wrote Apr 13, 2015 at 8:52 PM

This is also the case when the inner exception is the only argument.
catch(Exception ex)
{
    // Warning: "Caught exception should be passed as inner exception."
    throw new OuterException(ex);
}

rsuter wrote Apr 15, 2015 at 8:31 AM