diff --git a/WetPancake/ProductServices.fs b/WetPancake/ProductServices.fs index dee5c06..bbbe3bd 100644 --- a/WetPancake/ProductServices.fs +++ b/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 } ///