Created
September 23, 2013 19:04
-
-
Save thinktainer/6675294 to your computer and use it in GitHub Desktop.
continue task without 'T in f# and handle exception there
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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