Slightly improve error message in attrSetAlter

This commit is contained in:
Ryan Trinkle 2018-03-31 14:58:53 -04:00
parent eb51746b0e
commit 7976485874

View file

@ -284,10 +284,11 @@ attrSetAlter (p:ps) m val = case Map.lookup p m of
Just v | null ps -> go
| otherwise -> v >>= \case
NVSet s -> recurse (fmap forceThunk s)
_ -> throwError $ "attribute " ++ attr ++ " is not a set"
--TODO: Keep a stack of attributes we've already traversed, so
--that we can report that to the user
x -> throwError $ "attribute " ++ show p
++ " is not a set; its value is " ++ show (void x)
where
attr = show (Text.intercalate "." (p:ps))
go = return $ Map.insert p val m
recurse s = attrSetAlter ps s val >>= \m' ->