apluslms / a-plus-rst-tools

Tools to publish RST course content for mooc-grader and a-plus. Should be cloned as a course submodule.
MIT License
6 stars 24 forks source link

Explicit and easy-to-understand errors in the annotation directive #173

Open markkuriekkinen opened 1 year ago

markkuriekkinen commented 1 year ago

A teacher tried to use the code-block directive inside the annotation directive. The compilation error message about this is not easy to understand and thus, the teacher did not know that the problem stems from the invalid use of the annotation directive. Could the error message be more clear and explicit?

(NB. code-block may be used inside annotated, but not inside annotation that defines the text that is shown during mouse hovering.)

https://github.com/apluslms/a-plus-rst-tools/blob/master/directives/annotated.py https://github.com/apluslms/a-plus-rst-tools/blob/master/README.md#11-annotated-code-blocks

The confusing error message that the teacher saw was this traceback:

Exception occurred:
  File "/usr/local/lib/python3.7/dist-packages/docutils/nodes.py", line 652, in __getitem__
    return self.attributes[key]
KeyError: 'name'

Internal ticket: https://rt.cs.aalto.fi/Ticket/Display.html?id=24428