mrwilson / adr-viewer

Generate easy-to-read web pages for your Architecture Decision Records
MIT License
144 stars 25 forks source link

Table of contents leads to an error #5

Closed MahatmaFatalError closed 4 years ago

MahatmaFatalError commented 4 years ago

I have 3 ADRs. adr-viewer can server them fine, however, once there is a TOC it fails:

❯ adr generate toc > ./doc/adr/README.md
❯ adr-viewer --serve
Traceback (most recent call last):
  File "/usr/local/bin/adr-viewer", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/adr_viewer/__init__.py", line 102, in main
    content = generate_content(adr_path)
  File "/usr/local/lib/python3.7/site-packages/adr_viewer/__init__.py", line 88, in generate_content
    adr_attributes = parse_adr_to_config(adr_file)
  File "/usr/local/lib/python3.7/site-packages/adr_viewer/__init__.py", line 30, in parse_adr_to_config
    status = list(extract_statuses_from_adr(soup))
  File "/usr/local/lib/python3.7/site-packages/adr_viewer/__init__.py", line 13, in extract_statuses_from_adr
    current_node = status_section.nextSibling
AttributeError: 'NoneType' object has no attribute 'nextSibling'

IMHO it should at least not fail, e.g. by ignoring the TOC file.

mrwilson commented 4 years ago

Hi @MahatmaFatalError - thanks for this, I'll take a look