on master help sign in
Do not print a error message in loadYamlSettings
041e01aFelix Schnizlein
yaml/ChangeLog.md+4
@@ -1,5 +1,9 @@
1# ChangeLog for yaml
1# ChangeLog for yaml
2
2
3+## 0.11.0.2
4+
5+* Add `LoadSettingsException` exception and remove error printing from `loadYamlSettings` [#172](https://github.com/snoyberg/yaml/pull/172)
6+
3## 0.11.0.1
7## 0.11.0.1
4
8
5* Better error messages in the `Data.Yaml.Config` module [#168](https://github.com/snoyberg/yaml/issues/168)
9* Better error messages in the `Data.Yaml.Config` module [#168](https://github.com/snoyberg/yaml/issues/168)
yaml/package.yaml+1−1
@@ -1,5 +1,5 @@
1name: yaml
1name: yaml
2−version: 0.11.0.1
2+version: 0.11.0.2
3synopsis: Support for parsing and rendering YAML documents.
3synopsis: Support for parsing and rendering YAML documents.
4description: README and API documentation are available at <https://www.stackage.org/package/yaml>
4description: README and API documentation are available at <https://www.stackage.org/package/yaml>
5category: Data
5category: Data
yaml/src/Data/Yaml/Config.hs+1−3
@@ -180,9 +180,7 @@ loadYamlSettings runTimeFiles compileValues envUsage = do
180 runValues <- forM runTimeFiles $ \fp -> do
180 runValues <- forM runTimeFiles $ \fp -> do
181 eres <- YI.decodeFileEither fp
181 eres <- YI.decodeFileEither fp
182 case eres of
182 case eres of
183− Left e -> do
183+ Left e -> throwIO (Y.LoadSettingsException fp e)
184− putStrLn $ "loadYamlSettings: Could not parse file as YAML: " ++ fp
185− throwIO e
186 Right value -> return value
184 Right value -> return value
187
185
188 value' <-
186 value' <-
yaml/src/Data/Yaml/Internal.hs+2
@@ -62,6 +62,7 @@ data ParseException = NonScalarKey
62 | OtherParseException SomeException
62 | OtherParseException SomeException
63 | NonStringKeyAlias Y.AnchorName Value
63 | NonStringKeyAlias Y.AnchorName Value
64 | CyclicIncludes
64 | CyclicIncludes
65+ | LoadSettingsException FilePath ParseException
65 deriving (Show, Typeable)
66 deriving (Show, Typeable)
66
67
67instance Exception ParseException where
68instance Exception ParseException where
@@ -113,6 +114,7 @@ prettyPrintParseException pe = case pe of
113 , " Value: " ++ show value
114 , " Value: " ++ show value
114 ]
115 ]
115 CyclicIncludes -> "Cyclic includes"
116 CyclicIncludes -> "Cyclic includes"
117+ LoadSettingsException fp exc -> "Could not parse file as YAML: " ++ fp ++ "\n" ++ prettyPrintParseException exc
116
118
117defineAnchor :: Value -> String -> ReaderT JSONPath (ConduitM e o Parse) ()
119defineAnchor :: Value -> String -> ReaderT JSONPath (ConduitM e o Parse) ()
118defineAnchor value name = modify (modifyAnchors $ Map.insert name value)
120defineAnchor value name = modify (modifyAnchors $ Map.insert name value)