Skip to content

Task.OnExeption() #106803

Closed Answered by huoyaoyuan
mkmkmk asked this question in Ideas
Aug 22, 2024 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

Basically,

task.ContinueWith(t =>
{
    if (t.IsFaulted)
    {
        action(t.Exception);
    }
    else if (t.IsCanceled)
    {
        action(new TaskCanceledException());
    }
})

Does it make sense?

In .NET we don't actually use callback chain. Mixing await with callback chain just make things worse.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@mkmkmk
Comment options

Answer selected by mkmkmk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
2 participants