FTFY: import std.exception; void f() { // much code with many assert(0) enforce(0, "where's my message, line and file?"); // much code with many assert(0) } void main() { f(); } But the two are supposed to be used for different things.