diff --git a/bikeshed/metadata.py b/bikeshed/metadata.py index 8c072e71e0..0e2ebd068c 100644 --- a/bikeshed/metadata.py +++ b/bikeshed/metadata.py @@ -159,16 +159,20 @@ def addData(self, key: str, val: str, lineNum: str | int | None = None) -> Metad if key not in ("ED", "TR", "URL"): key = key.title() - self.allData[key].append(val) if key not in knownKeys: m.die(f'Unknown metadata key "{key}". Prefix custom keys with "!".', lineNum=lineNum) return self - md = knownKeys[key] - val = md.parse(key, val, lineNum=lineNum) + md = knownKeys[key] + try: + parsedVal = md.parse(key, val, lineNum=lineNum) + except Exception as e: + m.die(f"Error while parsing '{key}' metadata value:\n {val}\n{e}") + return self - self.addParsedData(key, val) + self.allData[key].append(val) + self.addParsedData(key, parsedVal) return self def addParsedData(self, key: str, val: t.Any) -> MetadataManager: