fsprojects / FSharp.Configuration

The FSharp.Configuration project contains type providers for the configuration of .NET projects.
http://fsprojects.github.io/FSharp.Configuration/
Other
114 stars 63 forks source link

Better exception/error mesages #65

Closed dmitry-a-morozov closed 9 years ago

dmitry-a-morozov commented 9 years ago

If expected connection string entry is missing at run-time the type provider throws

System.NullReferenceException: Object reference not set to an instance of an object. at FSharp.Configuration.AppSettingsTypeProvider.getConnectionString(String key) in D:\git\FSharp.Configuration\src\FSharp.Configuration\AppSettingsProvider.fs:line 28

It would be nice if it can raise more meaningful error. Something like raise <| System.KeyNotFoundException(sprintf "Cannot find name %s in section of config file." "AdventureWork")

I do similar thing in FSharp.Data.SqlClient https://github.com/fsprojects/FSharp.Data.SqlClient/blob/master/src/SqlClient/Configuration.fs#L88

vasily-kirichenko commented 9 years ago

Fixed in https://github.com/fsprojects/FSharp.Configuration/commit/8b97fb9d776c76a1293cd4cd4b63d6e6b73da8f6