Skip to content

Commit 12f54ba

Browse files
Update error logging for bad patterns in hexdoc (#931)
2 parents f5b0560 + eb8adf9 commit 12f54ba

File tree

1 file changed

+4
-1
lines changed
  • doc/src/hexdoc_hexcasting/book/page

1 file changed

+4
-1
lines changed

doc/src/hexdoc_hexcasting/book/page/pages.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ def patterns(self) -> list[PatternInfo]:
1919
@model_validator(mode="after")
2020
def _post_root_lookup(self, info: ValidationInfo):
2121
hex_ctx = HexContext.of(info)
22-
self._patterns = [hex_ctx.patterns[self.op_id]]
22+
pattern = hex_ctx.patterns.get(self.op_id)
23+
if pattern is None:
24+
raise ValueError(f"Unknown pattern ID (check your pattern stubs in hexdoc.toml): {self.op_id}")
25+
self._patterns = [pattern]
2326
return self
2427

2528
@model_validator(mode="after")

0 commit comments

Comments
 (0)