Skip to content

Instantly share code, notes, and snippets.

@thinktainer
Created September 23, 2013 19:04
Show Gist options
  • Save thinktainer/6675294 to your computer and use it in GitHub Desktop.
Save thinktainer/6675294 to your computer and use it in GitHub Desktop.
continue task without 'T in f# and handle exception there
member x.HandleExceptionOrContinue(t : Task) =
match t.IsFaulted with
| true ->
tracer.WriteLine(
(sprintf "Unhandled Exception when trying to send message: %O"
(t.Exception)), LogError); raise t.Exception
| arg -> ()
call it with
t.ContinueWith(
fun t -> (x.HandleExceptionOrContinue(t)))
|> Async.AwaitIAsyncResult
|> Async.Ignore
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment