Skip to content

Commit

Permalink
Better error message for Data.Yaml.Config #168
Browse files Browse the repository at this point in the history
  • Loading branch information
snoyberg committed Apr 23, 2019
1 parent b1aa6e9 commit 4210fa0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions yaml/ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# ChangeLog for yaml

## 0.11.0.1

* Better error messages in the `Data.Yaml.Config` module [#168](https://github.com/snoyberg/yaml/issues/168)

## 0.11.0.0

* Split out the `libyaml` and `Text.Libyaml` code into its own package. [#145](https://github.com/snoyberg/yaml/issues/145)
Expand Down
2 changes: 1 addition & 1 deletion yaml/package.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: yaml
version: 0.11.0.0
version: 0.11.0.1
synopsis: Support for parsing and rendering YAML documents.
description: README and API documentation are available at <https://www.stackage.org/package/yaml>
category: Data
Expand Down
6 changes: 3 additions & 3 deletions yaml/src/Data/Yaml/Config.hs
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,9 @@ loadYamlSettings runTimeFiles compileValues envUsage = do
UseCustomEnv env -> return $ applyEnvValue False env value'
RequireCustomEnv env -> return $ applyEnvValue True env value'

case fromJSON value of
Error s -> error $ "Could not convert to expected type: " ++ s
Success settings -> return settings
case Y.parseEither parseJSON value of
Left s -> error $ "Could not convert to expected type: " ++ s
Right settings -> return settings

-- | Same as @loadYamlSettings@, but get the list of runtime config files from
-- the command line arguments.
Expand Down

0 comments on commit 4210fa0

Please sign in to comment.