|
1 | 1 | """This is the ansys-sphinx-theme module."""
|
| 2 | +import logging |
2 | 3 | import pathlib
|
3 | 4 | from typing import Any, Dict
|
4 | 5 |
|
@@ -159,28 +160,32 @@ def fix_edit_link_page(link: str) -> str:
|
159 | 160 |
|
160 | 161 | if "_autosummary" in pagename:
|
161 | 162 | for obj_node in list(doctree.findall(addnodes.desc)):
|
162 |
| - domain = obj_node.get("domain") |
163 |
| - for signode in obj_node: |
164 |
| - if not isinstance(signode, addnodes.desc_signature): |
165 |
| - continue |
166 |
| - # Convert signode to a specified format |
167 |
| - info = {} |
168 |
| - for key in DOMAIN_KEYS.get(domain, []): |
169 |
| - value = signode.get(key) |
170 |
| - if not value: |
171 |
| - value = "" |
172 |
| - info[key] = value |
173 |
| - if not info: |
174 |
| - continue |
175 |
| - # This is an API example |
176 |
| - return sphinx_linkcode_resolve( |
177 |
| - domain=domain, |
178 |
| - info=info, |
179 |
| - library=f"{github_user}/{github_repo}", |
180 |
| - source_path=github_source, |
181 |
| - github_version=kind, |
182 |
| - edit=True, |
183 |
| - ) |
| 163 | + try: |
| 164 | + domain = obj_node.get("domain") |
| 165 | + for signode in obj_node: |
| 166 | + if not isinstance(signode, addnodes.desc_signature): |
| 167 | + continue |
| 168 | + # Convert signode to a specified format |
| 169 | + info = {} |
| 170 | + for key in DOMAIN_KEYS.get(domain, []): |
| 171 | + value = signode.get(key) |
| 172 | + if not value: |
| 173 | + value = "" |
| 174 | + info[key] = value |
| 175 | + if not info: |
| 176 | + continue |
| 177 | + # This is an API example |
| 178 | + return sphinx_linkcode_resolve( |
| 179 | + domain=domain, |
| 180 | + info=info, |
| 181 | + library=f"{github_user}/{github_repo}", |
| 182 | + source_path=github_source, |
| 183 | + github_version=kind, |
| 184 | + edit=True, |
| 185 | + ) |
| 186 | + except ValueError as e: |
| 187 | + logging.debug(f"An error occurred: {e}") # Log the exception as debug info |
| 188 | + return link |
184 | 189 |
|
185 | 190 | elif "autoapi" in pagename:
|
186 | 191 | for obj_node in list(doctree.findall(addnodes.desc)):
|
|
0 commit comments