Sha256: 000294489c63ad637462d0b993e13e19c1dcb93476b54792fca197086025a045
Contents?: true
Size: 729 Bytes
Versions: 396
Compression:
Stored size: 729 Bytes
Contents
module ErrorHandling open System type Result<'TSuccess, 'TError> = | Ok of 'TSuccess | Error of 'TError let handleErrorByThrowingException() = failwith "An error occurred." let handleErrorByReturningOption input = match Int32.TryParse input with | true, value -> Some value | false, _ -> None let handleErrorByReturningResult input = match Int32.TryParse input with | true, value -> Ok value | false, _ -> Error "Could not convert input to integer" let bind switchFunction twoTrackInput = match twoTrackInput with | Ok s -> switchFunction s | Error f -> Error f let cleanupDisposablesWhenThrowingException resource = use r = resource failwith "Throw exception"
Version data entries
396 entries across 396 versions & 1 rubygems