[Issue 17226] Exception during the generation of an assert message hides AssertError
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sun Feb 26 01:20:16 PST 2017
https://issues.dlang.org/show_bug.cgi?id=17226
Jack Stouffer <jack at jackstouffer.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jack at jackstouffer.com
--- Comment #1 from Jack Stouffer <jack at jackstouffer.com> ---
Full example of catching the exception and still going
import std.string;
import std.stdio;
void foo(int i) {
// In this case a %s is forgotten but it could be any other trivial error.
assert(i == 42, format("Bad parameter:", i));
}
void main() {
try {
foo(43);
} catch (Exception) {
writeln("something threw");
}
writeln("This still runs despite being in undefined state");
}
Yeah, this is really, really bad.
--
More information about the Digitalmars-d-bugs
mailing list