@@ -31,7 +31,7 @@ import Control.Monad.Trans.Resource (ResourceT, runResourceT)
31import Control.Monad.State.Strict
31import Control.Monad.State.Strict
32import Control.Monad.Reader
32import Control.Monad.Reader
33import Data.Aeson
33import Data.Aeson
34−import Data.Aeson.Internal (JSONPath, JSONPathElement(..))
34+import Data.Aeson.Internal (JSONPath, JSONPathElement(..), formatError)
35import Data.Aeson.Types hiding (parse)
35import Data.Aeson.Types hiding (parse)
36import qualified Data.Attoparsec.Text as Atto
36import qualified Data.Attoparsec.Text as Atto
37import Data.Bits (shiftL, (.|.))
37import Data.Bits (shiftL, (.|.))
@@ -68,6 +68,7 @@ data ParseException = NonScalarKey
68 | InvalidYaml (Maybe YamlException)
68 | InvalidYaml (Maybe YamlException)
69 | AesonException String
69 | AesonException String
70 | OtherParseException SomeException
70 | OtherParseException SomeException
71+ | NonStringKey JSONPath
71 | NonStringKeyAlias Y.AnchorName Value
72 | NonStringKeyAlias Y.AnchorName Value
72 | CyclicIncludes
73 | CyclicIncludes
73 | LoadSettingsException FilePath ParseException
74 | LoadSettingsException FilePath ParseException
@@ -116,6 +117,7 @@ prettyPrintParseException pe = case pe of
117 AesonException s -> "Aeson exception:\n" ++ s
118 AesonException s -> "Aeson exception:\n" ++ s
118 OtherParseException exc -> "Generic parse exception:\n" ++ show exc
119 OtherParseException exc -> "Generic parse exception:\n" ++ show exc
120+ NonStringKey path -> formatError path "Non-string keys are not supported"
119 NonStringKeyAlias anchor value -> unlines
121 NonStringKeyAlias anchor value -> unlines
120 [ "Non-string key alias:"
122 [ "Non-string key alias:"
121 , " Anchor name: " ++ anchor
123 , " Anchor name: " ++ anchor
@@ -258,7 +260,9 @@ parseM mergedKeys a front = do
258 Nothing -> liftIO $ throwIO $ UnknownAlias an
260 Nothing -> liftIO $ throwIO $ UnknownAlias an
259 Just (String t) -> return t
261 Just (String t) -> return t
260 Just v -> liftIO $ throwIO $ NonStringKeyAlias an v
262 Just v -> liftIO $ throwIO $ NonStringKeyAlias an v
261− _ -> liftIO $ throwIO $ UnexpectedEvent me Nothing
263+ _ -> do
265+ liftIO $ throwIO $ NonStringKey path
263 (mergedKeys', al') <- local (Key s :) $ do
267 (mergedKeys', al') <- local (Key s :) $ do
264 o <- parseO
268 o <- parseO