@@ -31,7 +31,7 @@ import Control.Monad.Trans.Resource (ResourceT, runResourceT)
3131import Control.Monad.State.Strict
3232import Control.Monad.Reader
3333import Data.Aeson
34−import Data.Aeson.Internal (JSONPath, JSONPathElement(..))
34+import Data.Aeson.Internal (JSONPath, JSONPathElement(..), formatError)
3535import Data.Aeson.Types hiding (parse)
3636import qualified Data.Attoparsec.Text as Atto
3737import Data.Bits (shiftL, (.|.))
@@ -68,6 +68,7 @@ data ParseException = NonScalarKey
6868 | InvalidYaml (Maybe YamlException)
6969 | AesonException String
7070 | OtherParseException SomeException
71+ | NonStringKey JSONPath
7172 | NonStringKeyAlias Y.AnchorName Value
7273 | CyclicIncludes
7374 | LoadSettingsException FilePath ParseException
@@ -116,6 +117,7 @@ prettyPrintParseException pe = case pe of
116117 ]
117118 AesonException s -> "Aeson exception:\n" ++ s
118119 OtherParseException exc -> "Generic parse exception:\n" ++ show exc
120+ NonStringKey path -> formatError path "Non-string keys are not supported"
119121 NonStringKeyAlias anchor value -> unlines
120122 [ "Non-string key alias:"
121123 , " Anchor name: " ++ anchor
@@ -258,7 +260,9 @@ parseM mergedKeys a front = do
258260 Nothing -> liftIO $ throwIO $ UnknownAlias an
259261 Just (String t) -> return t
260262 Just v -> liftIO $ throwIO $ NonStringKeyAlias an v
261− _ -> liftIO $ throwIO $ UnexpectedEvent me Nothing
263+ _ -> do
264+ path <- ask
265+ liftIO $ throwIO $ NonStringKey path
262266
263267 (mergedKeys', al') <- local (Key s :) $ do
264268 o <- parseO