Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve error message for unsupported nodes #421

Open
1 task done
rptb1 opened this issue Oct 22, 2023 · 4 comments
Open
1 task done

Improve error message for unsupported nodes #421

rptb1 opened this issue Oct 22, 2023 · 4 comments
Labels
bug crash rinohtype aborts due to an uncaught exception

Comments

@rptb1
Copy link

rptb1 commented Oct 22, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Sphinx or rinoh output

Traceback (most recent call last):
  File "/home/rb/git/mps/manual/tool/lib/python3.10/site-packages/rinoh/frontend/__init__.py", line 27, in map_node
    return cls._mapping[node_name.replace('-', '_')](node, **context)
KeyError: 'topics'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/rb/git/mps/manual/tool/lib/python3.10/site-packages/sphinx/cmd/build.py", line 281, in build_main
    app.build(args.force_all, args.filenames)
  File "/home/rb/git/mps/manual/tool/lib/python3.10/site-packages/sphinx/application.py", line 347, in build
    self.builder.build_update()
  File "/home/rb/git/mps/manual/tool/lib/python3.10/site-packages/sphinx/builders/__init__.py", line 307, in build_update
    self.build(['__all__'], to_build)
  File "/home/rb/git/mps/manual/tool/lib/python3.10/site-packages/sphinx/builders/__init__.py", line 376, in build
    self.write(docnames, list(updated_docnames), method)
  File "/home/rb/git/mps/manual/tool/lib/python3.10/site-packages/rinoh/frontend/sphinx/__init__.py", line 257, in write
    self.write_document(entry)
  File "/home/rb/git/mps/manual/tool/lib/python3.10/site-packages/rinoh/frontend/sphinx/__init__.py", line 263, in write_document
    rinoh_document = self.construct_rinohtype_document(data)
  File "/home/rb/git/mps/manual/tool/lib/python3.10/site-packages/rinoh/frontend/sphinx/__init__.py", line 279, in construct_rinohtype_document
    rinoh_tree = from_doctree(doctree, sphinx_builder=self)
  File "/home/rb/git/mps/manual/tool/lib/python3.10/site-packages/rinoh/frontend/rst/__init__.py", line 149, in from_doctree
    return mapped_tree.flowable()
  File "/home/rb/git/mps/manual/tool/lib/python3.10/site-packages/rinoh/frontend/__init__.py", line 132, in flowable
    flowable, = self.flowables()
  File "/home/rb/git/mps/manual/tool/lib/python3.10/site-packages/rinoh/frontend/rst/__init__.py", line 107, in flowables
    for flowable in super().flowables():
  File "/home/rb/git/mps/manual/tool/lib/python3.10/site-packages/rinoh/frontend/__init__.py", line 137, in flowables
    for i, flowable in enumerate(self.build_flowables()):
  File "/home/rb/git/mps/manual/tool/lib/python3.10/site-packages/rinoh/frontend/__init__.py", line 146, in build_flowables
    yield self.build_flowable()
  File "/home/rb/git/mps/manual/tool/lib/python3.10/site-packages/rinoh/frontend/__init__.py", line 162, in build_flowable
    return self.grouped_flowables_class(self.children_flowables(),
  File "/home/rb/git/mps/manual/tool/lib/python3.10/site-packages/rinoh/frontend/__init__.py", line 125, in children_flowables
    return list(chain(*(item.flowables() for item in children)))
  File "/home/rb/git/mps/manual/tool/lib/python3.10/site-packages/rinoh/frontend/rst/__init__.py", line 107, in flowables
    for flowable in super().flowables():
  File "/home/rb/git/mps/manual/tool/lib/python3.10/site-packages/rinoh/frontend/__init__.py", line 137, in flowables
    for i, flowable in enumerate(self.build_flowables()):
  File "/home/rb/git/mps/manual/tool/lib/python3.10/site-packages/rinoh/frontend/__init__.py", line 146, in build_flowables
    yield self.build_flowable()
  File "/home/rb/git/mps/manual/tool/lib/python3.10/site-packages/rinoh/frontend/__init__.py", line 162, in build_flowable
    return self.grouped_flowables_class(self.children_flowables(),
  File "/home/rb/git/mps/manual/tool/lib/python3.10/site-packages/rinoh/frontend/__init__.py", line 125, in children_flowables
    return list(chain(*(item.flowables() for item in children)))
  File "/home/rb/git/mps/manual/tool/lib/python3.10/site-packages/rinoh/frontend/rst/__init__.py", line 107, in flowables
    for flowable in super().flowables():
  File "/home/rb/git/mps/manual/tool/lib/python3.10/site-packages/rinoh/frontend/__init__.py", line 137, in flowables
    for i, flowable in enumerate(self.build_flowables()):
  File "/home/rb/git/mps/manual/tool/lib/python3.10/site-packages/rinoh/frontend/__init__.py", line 146, in build_flowables
    yield self.build_flowable()
  File "/home/rb/git/mps/manual/tool/lib/python3.10/site-packages/rinoh/frontend/sphinx/nodes.py", line 240, in build_flowable
    return super().build_flowable(id='%' + self.get('docname'), **kwargs)
  File "/home/rb/git/mps/manual/tool/lib/python3.10/site-packages/rinoh/frontend/__init__.py", line 162, in build_flowable
    return self.grouped_flowables_class(self.children_flowables(),
  File "/home/rb/git/mps/manual/tool/lib/python3.10/site-packages/rinoh/frontend/__init__.py", line 125, in children_flowables
    return list(chain(*(item.flowables() for item in children)))
  File "/home/rb/git/mps/manual/tool/lib/python3.10/site-packages/rinoh/frontend/rst/__init__.py", line 107, in flowables
    for flowable in super().flowables():
  File "/home/rb/git/mps/manual/tool/lib/python3.10/site-packages/rinoh/frontend/__init__.py", line 137, in flowables
    for i, flowable in enumerate(self.build_flowables()):
  File "/home/rb/git/mps/manual/tool/lib/python3.10/site-packages/rinoh/frontend/__init__.py", line 146, in build_flowables
    yield self.build_flowable()
  File "/home/rb/git/mps/manual/tool/lib/python3.10/site-packages/rinoh/frontend/__init__.py", line 162, in build_flowable
    return self.grouped_flowables_class(self.children_flowables(),
  File "/home/rb/git/mps/manual/tool/lib/python3.10/site-packages/rinoh/frontend/__init__.py", line 125, in children_flowables
    return list(chain(*(item.flowables() for item in children)))
  File "/home/rb/git/mps/manual/tool/lib/python3.10/site-packages/rinoh/frontend/rst/__init__.py", line 107, in flowables
    for flowable in super().flowables():
  File "/home/rb/git/mps/manual/tool/lib/python3.10/site-packages/rinoh/frontend/__init__.py", line 137, in flowables
    for i, flowable in enumerate(self.build_flowables()):
  File "/home/rb/git/mps/manual/tool/lib/python3.10/site-packages/rinoh/frontend/__init__.py", line 146, in build_flowables
    yield self.build_flowable()
  File "/home/rb/git/mps/manual/tool/lib/python3.10/site-packages/rinoh/frontend/__init__.py", line 162, in build_flowable
    return self.grouped_flowables_class(self.children_flowables(),
  File "/home/rb/git/mps/manual/tool/lib/python3.10/site-packages/rinoh/frontend/__init__.py", line 125, in children_flowables
    return list(chain(*(item.flowables() for item in children)))
  File "/home/rb/git/mps/manual/tool/lib/python3.10/site-packages/rinoh/frontend/rst/__init__.py", line 107, in flowables
    for flowable in super().flowables():
  File "/home/rb/git/mps/manual/tool/lib/python3.10/site-packages/rinoh/frontend/__init__.py", line 137, in flowables
    for i, flowable in enumerate(self.build_flowables()):
  File "/home/rb/git/mps/manual/tool/lib/python3.10/site-packages/rinoh/frontend/__init__.py", line 146, in build_flowables
    yield self.build_flowable()
  File "/home/rb/git/mps/manual/tool/lib/python3.10/site-packages/rinoh/frontend/sphinx/nodes.py", line 240, in build_flowable
    return super().build_flowable(id='%' + self.get('docname'), **kwargs)
  File "/home/rb/git/mps/manual/tool/lib/python3.10/site-packages/rinoh/frontend/__init__.py", line 162, in build_flowable
    return self.grouped_flowables_class(self.children_flowables(),
  File "/home/rb/git/mps/manual/tool/lib/python3.10/site-packages/rinoh/frontend/__init__.py", line 125, in children_flowables
    return list(chain(*(item.flowables() for item in children)))
  File "/home/rb/git/mps/manual/tool/lib/python3.10/site-packages/rinoh/frontend/rst/__init__.py", line 107, in flowables
    for flowable in super().flowables():
  File "/home/rb/git/mps/manual/tool/lib/python3.10/site-packages/rinoh/frontend/__init__.py", line 137, in flowables
    for i, flowable in enumerate(self.build_flowables()):
  File "/home/rb/git/mps/manual/tool/lib/python3.10/site-packages/rinoh/frontend/__init__.py", line 146, in build_flowables
    yield self.build_flowable()
  File "/home/rb/git/mps/manual/tool/lib/python3.10/site-packages/rinoh/frontend/__init__.py", line 162, in build_flowable
    return self.grouped_flowables_class(self.children_flowables(),
  File "/home/rb/git/mps/manual/tool/lib/python3.10/site-packages/rinoh/frontend/__init__.py", line 125, in children_flowables
    return list(chain(*(item.flowables() for item in children)))
  File "/home/rb/git/mps/manual/tool/lib/python3.10/site-packages/rinoh/frontend/rst/__init__.py", line 107, in flowables
    for flowable in super().flowables():
  File "/home/rb/git/mps/manual/tool/lib/python3.10/site-packages/rinoh/frontend/__init__.py", line 137, in flowables
    for i, flowable in enumerate(self.build_flowables()):
  File "/home/rb/git/mps/manual/tool/lib/python3.10/site-packages/rinoh/frontend/__init__.py", line 146, in build_flowables
    yield self.build_flowable()
  File "/home/rb/git/mps/manual/tool/lib/python3.10/site-packages/rinoh/frontend/__init__.py", line 162, in build_flowable
    return self.grouped_flowables_class(self.children_flowables(),
  File "/home/rb/git/mps/manual/tool/lib/python3.10/site-packages/rinoh/frontend/__init__.py", line 124, in children_flowables
    children = self.getchildren()[skip_first:]
  File "/home/rb/git/mps/manual/tool/lib/python3.10/site-packages/rinoh/frontend/__init__.py", line 64, in getchildren
    return [self.map_node(child, **self.context)
  File "/home/rb/git/mps/manual/tool/lib/python3.10/site-packages/rinoh/frontend/__init__.py", line 64, in <listcomp>
    return [self.map_node(child, **self.context)
  File "/home/rb/git/mps/manual/tool/lib/python3.10/site-packages/rinoh/frontend/__init__.py", line 30, in map_node
    raise NotImplementedError("{}:{} the '{}' node is not yet supported "
NotImplementedError: /home/rb/git/mps/manual/source/guide/lang.rst:None the 'topics' node is not yet supported (rinoh.frontend.rst.nodes)

Exception occurred:
  File "/home/rb/git/mps/manual/tool/lib/python3.10/site-packages/rinoh/frontend/__init__.py", line 30, in map_node
    raise NotImplementedError("{}:{} the '{}' node is not yet supported "
NotImplementedError: /home/rb/git/mps/manual/source/guide/lang.rst:None the 'topics' node is not yet supported (rinoh.frontend.rst.nodes)
The full traceback has been saved in /tmp/sphinx-err-9s3hvehp.log, if you want to report the issue to the developers.
Please also report this if it was a user error, so that a better error message can be provided next time.
A bug report can be filed in the tracker at <https://github.com/sphinx-doc/sphinx/issues>. Thanks!
make: *** [Makefile:56: pdf] Error 2

Source files

The Sphinx source tree is available at https://github.com/Ravenbrook/mps/tree/branch/2023-10-22/rinohtype-pdf-manual/manual and include instructions for building the manual , but briefly:

git clone --branch branch/2023-10-22/rinohtype-pdf-manual --depth 1 https://github.com/Ravenbrook/mps.git
cd mps
make -C manual pdf

Versions

rb@kiwi:~/tmp/mps/manual$ tool/bin/rinoh --versions
rinohtype 0.5.4 (2022-06-17)
Sphinx 7.2.6
Python 3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0]
Linux-6.2.0-34-generic-x86_64-with-glibc2.35
rb@kiwi:~/tmp/mps/manual$ uname -a
Linux kiwi 6.2.0-34-generic #34~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Sep  7 13:12:03 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
rb@kiwi:~/tmp/mps/manual$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 22.04.3 LTS
Release:	22.04
Codename:	jammy
@rptb1 rptb1 added bug crash rinohtype aborts due to an uncaught exception labels Oct 22, 2023
@rptb1
Copy link
Author

rptb1 commented Oct 22, 2023

You can also edit manual/requirements.pip to read rinohtype @ git+https://github.com/brechtm/rinohtype@master to reproduce on master.

@rptb1
Copy link
Author

rptb1 commented Oct 22, 2023

You can also view the version of the manual this is based on at https://memory-pool-system--270.org.readthedocs.build/en/270/

@brechtm
Copy link
Owner

brechtm commented Oct 23, 2023

The MPS Sphinx extension defines new admonition types (among other elements). You need to define rinohtype "translator" classes, or, preferably, implement these custom document elements in a backend-independent manner. Please see the discussion in #201 for more information.

@rptb1
Copy link
Author

rptb1 commented Oct 24, 2023

Many thanks for the pointer. This is a background project so it might be some time before I can get back to it.

Clearly we can't expect rinohtype to cope with arbitrary custom code. Perhaps there's a way to notice it and improve the messages though, so that you don't get further issues like this one.

@brechtm brechtm changed the title Failure rendering MPS manual: the 'topics' node is not yet supported Improve error message for unsupported nodes Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug crash rinohtype aborts due to an uncaught exception
Projects
None yet
Development

No branches or pull requests

2 participants