-
Notifications
You must be signed in to change notification settings - Fork 285
Description
Description
I'm using CSV type provider with Schema parameter.
If I accidentally will write the wrong path to my csv file, or the file itself is accidentally will be deleted, then instead of showing error that the file is not found, CSV type provider showing the strange error.

Repro steps
Script which was used.
#r @"./packages/FSharp.Data/lib/net40/FSharp.Data.dll"
open FSharp.Data
[<Literal>]
let incorrectPathToCSV = @"../export_commerce_backoffice_orders.csv"
[<Literal>]
let correctPathToCSV = @"export_commerce_backoffice_orders.csv"
type OrdersCSV =
CsvProvider< incorrectPathToCSV
, Separators = "$"
, HasHeaders = false
, Schema = "OrderNumber (string),OrderCreated (string),OrderTotal (float),FioShort (string option),PhoneNumber (string option),Email (string option),Comment (string option),FioFull (string option),Region (string option),Town (string option),Address (string option),Postindex (string option),ProductId (int option),ProductTitle (string),ProductQuantity (float),ProductPrice (decimal), NotUsed (string option)"
, PreferOptionals = true
>
let csv = OrdersCSV.GetSample()
Expected behavior
Type provider must shows error like this "Input file <...> not found!".
Actual behavior
Type provider shows the strange error like this "The provided schema contains 17 columns, the inference found 1 columns - please check the number of columns and the separator".
In addition:
If the Schema parameter is not presented and path to CSV file also incorrect, then the type provider does not show any error. But the code like this
for r in csv.Rows do
printfn "%A" r
prints some nonsense (my incorrect path to csv file).
"../export_commerce_backoffice_orders.csv"
val it : unit = ()
Known workarounds
Write right path)