# Handle Exceptions with Task.WhenAll()

```c#
var tasks = Enumerable.Range(0, 10).Select(async _ => await Task.Delay(1000));
var whenAll = Task.WhenAll(tasks);
try
{
  await whenAll;
}
catch {}
if (whenAll.Exception is AggregateException ex)
{
  //Handle Exception
}
  
```

[https://www.youtube.com/watch?v=s\_NrqRI7Gnc&amp;t=321s](https://www.youtube.com/watch?v=s_NrqRI7Gnc&t=321s)<iframe allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen="allowfullscreen" frameborder="0" height="315" src="https://www.youtube.com/embed/s_NrqRI7Gnc?si=-zTzIp8LCLxUI7s0&start=383" title="YouTube video player" width="560"></iframe>