19378, "bmcdonald3", "Throwing within a forall loop in a function not caught by try/catch", "2022-03-08T01:56:41Z"
Summary of Problem
Throwing within a forall
loop inside of a function is not caught by a try/catch wrapping the function.
Steps to Reproduce
This code will report uncaught TaskErrors:
try {
loop();
} catch e {
writeln("Caught error");
}
proc loop() throws {
forall i in 0..0 do
throw new Error();
}
But it seems like the error should be propagated upwards and caught by the overarching try/catch, printing "Caught error".
This code will catch the error and work as I'd expect, but it seems strange that the extra try/catch is required.
try {
loop();
} catch e {
writeln("Caught error");
}
proc loop() throws {
try {
forall i in 0..0 do
throw new Error();
} catch e {
throw e;
}
}
Related issue: #18773
Related future test: