void throwy()
{
auto e = new Exception("root");
scope (exit) throw new Exception("scope 1", e);
throw e;
}
void main()
{
throwy();
}
This results in an infinite loop in druntime. There are only two exceptions, but because they form a loop instead of a proper linked list, druntime keeps on printing them.
Perhaps we should define a reasonable limit on the number of exceptions we print before quitting out. 10 should probably be plenty.
Comment #1 by schveiguy — 2018-09-06T18:06:37Z
There are 2 options other than adding just a limit. First, we could use tortoise and hare algorithm to detect the cycle. Second, we could mark each exception somehow as it is printed, and then unmark them after the printing algorithm is over.
Comment #2 by robert.schadek — 2024-12-07T13:38:35Z