Commits

Alexander Shorin committed cefaa14

Fix build error for referencing on unknown http resource directive

This problem was already in docs, but starts to happen after d48059648c73.

  • Participants
  • Parent commits d480596
  • Branches optional-strict-mode

Comments (0)

Files changed (1)

File httpdomain/sphinxcontrib/httpdomain.py

             role = self.roles.get(typ)
             if role is None:
                 return nodes.emphasis(text, text)
-            return role.result_nodes(env.get_doctree(fromdocname),
-                                     env, node, None)[0][0]
+            resnode = role.result_nodes(env.get_doctree(fromdocname),
+                                        env, node, None)[0][0]
+            if isinstance(resnode, addnodes.pending_xref):
+                text = node[0][0]
+                reporter = env.get_doctree(fromdocname).reporter
+                reporter.error('Cannot resolve reference to %r' % text,
+                               line=node.line)
+                return nodes.problematic(text, text)
+            return resnode
         else:
             anchor = http_resource_anchor(typ, target)
             title = typ.upper() + ' ' + target