Skip to content
This repository has been archived by the owner on Jan 13, 2024. It is now read-only.

Commit

Permalink
catch more exception
Browse files Browse the repository at this point in the history
  • Loading branch information
sdpython committed Feb 20, 2022
1 parent 81da8cc commit bec6041
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/pyquickhelper/sphinxext/sphinx_blocref_extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,8 +426,20 @@ def process_blocref_nodes_generic(app, doctree, fromdocname, class_name,
para = nodes.paragraph(classes=['%s-source' % class_name])

# Create a target?
int_ids = ['index%s-%s' % (blocref_info['target']['refid'],
env.new_serialno(blocref_info['target']['refid']))]
try:
targ = blocref_info['target']
except KeyError as e:
logger = logging.getLogger("blocref")
logger.warning("Unable to find key 'target' in %r (e=%r)", blocref_info, e)
continue
try:
targ_refid = blocref_info['target']['refid']
except KeyError as e:
logger = logging.getLogger("blocref")
logger.warning("Unable to find key 'refid' in %r (e=%r)",
targ, e)
continue
int_ids = ['index%s-%s' % (targ_refid, env.new_serialno(targ_refid))]
int_targetnode = nodes.target(
blocref_info['breftitle'], '', ids=int_ids)
para += int_targetnode
Expand Down

0 comments on commit bec6041

Please sign in to comment.