import core.exception : AssertError; //import std.exception : assertThrown, assertNotThrown; bool foo() { throw new Exception("e"); } bool bar() { return true; } assertThrown!(AssertError)(assertThrown!(AssertError)(bar())); assertThrown!(AssertError)(assertNotThrown!(Exception)(foo()));