Exception Behavior
During the discussion about the APM and the EAP, you saw how dealing with errors can be tricky. The problem with those patterns lies in their multiphased nature, where exceptions can occur at various stages. In the world of the APM, exceptions can come out during Begin and End method calls. When using the EAP, exceptions can occur during the Async start operation, but can be reported through the Completed event arguments as well.
For the TAP, things are much simpler. Other than method parameter usage exceptions (such as ArgumentException), no errors should be raised when invoking the TAP method. Instead, all exceptions have to be propagated through the returned task object. Users of the method can inspect the returned task ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access