diff --git a/code/hsec-tools/src/Security/Advisories/Format.hs b/code/hsec-tools/src/Security/Advisories/Format.hs index b5f8007..19037c5 100644 --- a/code/hsec-tools/src/Security/Advisories/Format.hs +++ b/code/hsec-tools/src/Security/Advisories/Format.hs @@ -139,8 +139,17 @@ instance Toml.ToTable AdvisoryMetadata where instance Toml.FromValue GHCComponent where fromValue v = case v of Toml.Text' _ n - | Just c <- ghcComponentFromText n -> pure c - _ -> Toml.failAt (Toml.valueAnn v) $ T.unpack $ "Invalid component, expected " <> T.intercalate "|" componentNames + | Just c <- ghcComponentFromText n + -> pure c + | otherwise + -> Toml.failAt (Toml.valueAnn v) $ + "Invalid ghc-component '" + <> T.unpack n + <> "', expected " + <> T.unpack (T.intercalate "|" componentNames) + _ -> Toml.failAt (Toml.valueAnn v) $ + "Non-text ghc-component, expected" + <> T.unpack (T.intercalate "|" componentNames) where componentNames = map ghcComponentToText [minBound..maxBound]