Skip to content

Commit

Permalink
Merge pull request #58 from GenevieveBuckley/reraise-error-messages
Browse files Browse the repository at this point in the history
Re-raise errors for better ExtensionError messages
  • Loading branch information
smarie committed Nov 21, 2023
2 parents d4c2d7f + c33ae78 commit 35e7961
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
### 0.7.9 - (In Progress)

- Swapped from deprecated `disutils.version` to `packaging.version`. PR [#79](https://github.com/smarie/mkdocs-gallery/pull/79) by [Samreay](https://github.com/Samreay)
- Re-raise errors for better ExtensionError messages, so users have full details about the original problem. PR [#58](https://github.com/smarie/mkdocs-gallery/pull/58) by [GenevieveBuckley](https://github.com/GenevieveBuckley)

### 0.7.8 - Bugfixes

Expand Down
8 changes: 4 additions & 4 deletions src/mkdocs_gallery/gen_gallery.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,15 +144,15 @@ def load_base_conf(script: Path = None) -> Dict:
spec = spec_from_file_location("__mkdocs_gallery_conf", script)
foo = module_from_spec(spec)
spec.loader.exec_module(foo)
except ImportError:
raise ExtensionError(f"Error importing base configuration from `base_conf_py` {script}")
except ImportError as err_msg:
raise ExtensionError(f"Error importing base configuration from `base_conf_py` {script}\n{err_msg}")

try:
return foo.conf
except AttributeError:
except AttributeError as err_msg:
raise ExtensionError(
f"Error loading base configuration from `base_conf_py` {script}, module does not contain "
f"a `conf` variable."
f"a `conf` variable.\n{err_msg}"
)


Expand Down

0 comments on commit 35e7961

Please sign in to comment.