Skip to content

Commit a91fe22

Browse files
committed
minimal yaml error checking
1 parent 3747a95 commit a91fe22

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

quartodoc/autosummary.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -449,17 +449,13 @@ def load_layout(self, sections: dict, package: str):
449449
# TODO: currently returning the list of sections, to make work with
450450
# previous code. We should make Layout a first-class citizen of the
451451
# process.
452-
# import ipdb; ipdb.set_trace()
453-
# sys.tracebacklimit = 0
454452
try:
455453
return layout.Layout(sections=sections, package=package)
456454
except ValidationError as e:
457-
raise e
458455
msg = 'Configuration error(s) for YAML:\n - '
459-
msg += '\n - '.join(fmt(err) for err in e.errors())
456+
msg += '\n - '.join([fmt(err) for err in e.errors() if fmt(err)])
460457
raise ValueError(msg) from None
461458

462-
463459
# building ----------------------------------------------------------------
464460

465461
def build(self, filter: str = "*"):

quartodoc/tests/test_validation.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ def test_missing_desc():
6565
assert '- Missing field `desc` for element 2 in the list for `sections`' in str(e.value)
6666

6767
def test_missing_name_contents():
68+
# This is failing on purpose, will fix in pair programming
6869
sections = copy.deepcopy(EXAMPLE_SECTIONS)
6970
del sections[2]['contents'][0]['name']
7071
Builder(sections=sections, package='quartodoc')

quartodoc/validation.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
def fmt(err:dict):
33
"format error messages from pydantic."
44
msg = ""
5+
if err['msg'].startswith('Discriminator'):
6+
return msg
57
if err['type'] == 'value_error.missing':
68
msg += 'Missing field'
79
else:

0 commit comments

Comments
 (0)