Browse Source

Added TextIsValid logic to RequestTextFromFile function.

master
Craig Oates 6 years ago
parent
commit
b2db59f970
  1. 7
      WetPancake/ProductServices.fs

7
WetPancake/ProductServices.fs

@ -44,7 +44,7 @@ module Pancake =
| :? InvalidOperationException -> return text
}
let TextInFileIsValid filePath =
let TextInFileIsValidAsync filePath =
async {
return DataAccess.LoadFile filePath |> TextContainsValidEndToken
}
@ -153,7 +153,9 @@ module Pancake =
GibberishLevelIsValid gibberishLevel |> ignore
SentencesIsValid sentences |> ignore
FilePathIsValid filePath |> ignore
// pattern match the TextInFileIsValid function
let! textIsValid = TextInFileIsValidAsync filePath
if textIsValid = true then ignore ()
else failwith @"The .txt file does not contain an end token ('.', '!' or '?')."
let data =
LoadFile filePath
|> ApplyStandardSetup
@ -163,6 +165,7 @@ module Pancake =
with
| :? ArgumentException as ex -> return ex.Message
| :? FileNotFoundException as ex -> return ex.Message
| :? SystemException as ex -> return ex.Message
}
/// <summary>

Loading…
Cancel
Save