on master help sign in
Do not print a error message in loadYamlSettings
commit041e01a616ef7e97ddf52e29daabeadf7d507746 authorFelix Schnizlein <fschnizlein@suse.com> dateTue 25 Jun 2019, 17:34 (7 years ago) parent4210fa0
4 files changed+8−4
yaml/ChangeLog.md+4 yaml/package.yaml+1−1 yaml/src/Data/Yaml/Config.hs+1−3 yaml/src/Data/Yaml/Internal.hs+2
yaml/ChangeLog.md+4
@@ -1,5 +1,9 @@
11# ChangeLog for yaml
22
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+
37## 0.11.0.1
48
59* 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 @@
11name: yaml
2−version: 0.11.0.1
2+version: 0.11.0.2
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+1−3
@@ -180,9 +180,7 @@ loadYamlSettings runTimeFiles compileValues envUsage = do
180180 runValues <- forM runTimeFiles $ \fp -> do
181181 eres <- YI.decodeFileEither fp
182182 case eres of
183− Left e -> do
184− putStrLn $ "loadYamlSettings: Could not parse file as YAML: " ++ fp
185− throwIO e
183+ Left e -> throwIO (Y.LoadSettingsException fp e)
186184 Right value -> return value
187185
188186 value' <-
yaml/src/Data/Yaml/Internal.hs+2
@@ -62,6 +62,7 @@ data ParseException = NonScalarKey
6262 | OtherParseException SomeException
6363 | NonStringKeyAlias Y.AnchorName Value
6464 | CyclicIncludes
65+ | LoadSettingsException FilePath ParseException
6566 deriving (Show, Typeable)
6667
6768instance Exception ParseException where
@@ -113,6 +114,7 @@ prettyPrintParseException pe = case pe of
113114 , " Value: " ++ show value
114115 ]
115116 CyclicIncludes -> "Cyclic includes"
117+ LoadSettingsException fp exc -> "Could not parse file as YAML: " ++ fp ++ "\n" ++ prettyPrintParseException exc
116118
117119defineAnchor :: Value -> String -> ReaderT JSONPath (ConduitM e o Parse) ()
118120defineAnchor value name = modify (modifyAnchors $ Map.insert name value)