File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -193,6 +193,22 @@ function waitException(Tornado\EventLoop $eventLoop)
193
193
}
194
194
```
195
195
196
+ When using [ ` EventLoop::async ` ] ( src/EventLoop.php ) ,
197
+ all exceptions thrown inside the generator will reject the returned [ ` Promise ` ] ( src/Promise.php ) .
198
+ In case of a background computing you may ignore this [ ` Promise ` ] ( src/Promise.php ) and not ` yield ` nor wait it,
199
+ but * Tornado* will still catch thrown exceptions to prevent to miss them.
200
+ By design, an ignored rejected [ ` Promise ` ] ( src/Promise.php ) will throw its exception during its destruction.
201
+ It means that if you ** really** want to ignore all exceptions (really?),
202
+ you have to catch and ignore them ** explicitly** in your code.
203
+ ``` php
204
+ $ignoredPromise = $eventLoop->async((function() {
205
+ try {
206
+ yield from throwingGenerator();
207
+ } catch(\Throwable $throwable) {
208
+ // I want to ignore all exceptions for this function
209
+ }
210
+ })());
211
+ ```
196
212
197
213
## FAQ
198
214
You can’t perform that action at this time.
0 commit comments