on master help sign in
Better error message for Data.Yaml.Config #168
commit4210fa09e7b043ff18f71e32e74055fcbb418be1 authorMichael Snoyman <michael@snoyman.com> dateTue 23 Apr 2019, 11:28 (7 years ago) parentb1aa6e9
3 files changed+8−4
yaml/ChangeLog.md+4 yaml/package.yaml+1−1 yaml/src/Data/Yaml/Config.hs+3−3
yaml/ChangeLog.md+4
@@ -1,5 +1,9 @@
11# ChangeLog for yaml
22
3+## 0.11.0.1
4+
5+* Better error messages in the `Data.Yaml.Config` module [#168](https://github.com/snoyberg/yaml/issues/168)
6+
37## 0.11.0.0
48
59* Split out the `libyaml` and `Text.Libyaml` code into its own package. [#145](https://github.com/snoyberg/yaml/issues/145)
yaml/package.yaml+1−1
@@ -1,5 +1,5 @@
11name: yaml
2−version: 0.11.0.0
2+version: 0.11.0.1
33synopsis: Support for parsing and rendering YAML documents.
44description: README and API documentation are available at <https://www.stackage.org/package/yaml>
55category: Data
yaml/src/Data/Yaml/Config.hs+3−3
@@ -197,9 +197,9 @@ loadYamlSettings runTimeFiles compileValues envUsage = do
197197 UseCustomEnv env -> return $ applyEnvValue False env value'
198198 RequireCustomEnv env -> return $ applyEnvValue True env value'
199199
200− case fromJSON value of
201− Error s -> error $ "Could not convert to expected type: " ++ s
202− Success settings -> return settings
200+ case Y.parseEither parseJSON value of
201+ Left s -> error $ "Could not convert to expected type: " ++ s
202+ Right settings -> return settings
203203
204204-- | Same as @loadYamlSettings@, but get the list of runtime config files from
205205-- the command line arguments.