Bug 22025 – Exception within a delegate can't be thrown.
Status
RESOLVED
Resolution
DUPLICATE
Severity
critical
Priority
P1
Component
druntime
Product
D
Version
D2
Platform
x86_64
OS
Mac OS X
Creation time
2021-06-15T09:53:03Z
Last change time
2021-11-22T14:14:15Z
Keywords
backend
Assigned to
No Owner
Creator
Heromyth
Comments
Comment #0 by bitworld — 2021-06-15T09:53:03Z
When throwing an exception within a delegate, the app crashed.
My OS is macOS Big Sur 11.4. It's OK in Linux.
Tested compilers: DMD 2.088.1 - 2.097.0
Here is the sample:
```
void main() {
int factor = 2;
auto ex2a = new Promise!int();
auto ex2b = ex2a.then!(async!((int x) {
if(x == 30) {
// It's a bug in macOS Big Sur 11.4
throw new Exception("throw an exception!");
}
return x * factor;
}));
ex2a.resolve(30); // throw an exception!
}
```
The steps are here for reproducing this bug:
```
$ git clone https://github.com/Heromyth/future.git
$ cd future
$ dub run
```
Comment #1 by pro.mathias.lang — 2021-06-16T05:23:20Z
Library issue, not compiler.
Tested on 11.6, and output of result is the same as Linux, so this is a indeed a duplicate.
*** This issue has been marked as a duplicate of issue 21919 ***