summaryrefslogtreecommitdiff
path: root/hadrian/src/Settings.hs
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2021-02-24 09:01:57 -0500
committerBen Gamari <ben@smart-cactus.org>2021-02-24 11:15:41 -0500
commit559e4b2b33ee33c3f30ded3cb9856324ecb49382 (patch)
treebf87453dc0827a6724670854e73bfd0f08e53002 /hadrian/src/Settings.hs
parent003ea780e93d9885aaf8da7b8df3504d474bef33 (diff)
downloadhaskell-559e4b2b33ee33c3f30ded3cb9856324ecb49382.tar.gz
hadrian: Throw error on unknown key-value setting name
Diffstat (limited to 'hadrian/src/Settings.hs')
-rwxr-xr-xhadrian/src/Settings.hs7
1 files changed, 5 insertions, 2 deletions
diff --git a/hadrian/src/Settings.hs b/hadrian/src/Settings.hs
index ab17c5f320..1fe5763397 100755
--- a/hadrian/src/Settings.hs
+++ b/hadrian/src/Settings.hs
@@ -70,7 +70,10 @@ flavour = do
flavourName <- fromMaybe userDefaultFlavour <$> cmdFlavour
kvs <- userSetting ([] :: [KeyVal])
let flavours = hadrianFlavours ++ userFlavours
- (_settingErrs, tweak) = applySettings kvs
+ (settingErrs, tweak) = applySettings kvs
+
+ when (not $ null settingErrs) $ fail
+ $ "failed to apply key-value settings:" ++ unlines (map (" - " ++) settingErrs)
case parseFlavour flavours flavourTransformers flavourName of
Left err -> fail err
@@ -192,7 +195,7 @@ applySettings kvs = case partitionEithers (map applySetting kvs) of
applySetting :: KeyVal -> Either SettingError (Flavour -> Flavour)
applySetting (KeyVal ks op v) = case runSettingsM ks builderPredicate of
Left err -> throwError $
- "error while setting " ++ show ks ++ ": " ++ err
+ "error while setting `" ++ intercalate "`." ks ++ ": " ++ err
Right pred -> Right $ \flav -> flav
{ args = update (args flav) pred }