diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index f8b2448..b5444a3 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,4 +1,4 @@ -#### 0.0.20 - 12.03.2015 +#### 0.0.21 - 12.03.2015 * Improving C# support #### 0.0.10 - 10.03.2015 diff --git a/src/Chessie/ErrorHandling.fs b/src/Chessie/ErrorHandling.fs index 2713b1e..ccb2fd4 100644 --- a/src/Chessie/ErrorHandling.fs +++ b/src/Chessie/ErrorHandling.fs @@ -314,4 +314,13 @@ type ResultExtensions () = static member inline SucceededWith(this:Result<'TSuccess, 'TMessage>) : 'TSuccess = match this with | Ok(v,msgs) -> v - | Fail(msgs) -> failwithf "Result was an error: %s" (String.Join(Environment.NewLine, msgs |> Seq.map (fun x -> x.ToString()))) \ No newline at end of file + | Fail(msgs) -> failwithf "Result was an error: %s" (String.Join(Environment.NewLine, msgs |> Seq.map (fun x -> x.ToString()))) + + + [] + /// Executes the given function on a given success or captures the failure + static member inline Try(func: Func<_>) = + try + ok(func.Invoke()) + with + | exn -> fail exn \ No newline at end of file