Skip to content

Commit

Permalink
catch version.InvalidVersion
Browse files Browse the repository at this point in the history
  • Loading branch information
landmaj committed May 22, 2024
1 parent 0456ac4 commit fe534da
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions d2/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,14 @@ def on_config(self, config: MkDocsConfig) -> Optional[MkDocsConfig]:
raise ConfigurationError(f"executable '{self.config.executable}' not found")
raw_version = result.stdout.decode().strip()
raw_version = raw_version.split("-")[0] # remove git commit info
d2_version = version.parse(raw_version)
if d2_version < REQUIRED_VERSION:
warning(
f"required d2 version {REQUIRED_VERSION} not satisfied "
"or version format not recognized; found {d2_version}"
)
try:
d2_version = version.parse(raw_version)
if d2_version < REQUIRED_VERSION:
warning(
f"required d2 version {REQUIRED_VERSION} not satisfied; found {d2_version}"
)
except version.InvalidVersion:
warning(f"version format not recognized; found {raw_version}")

renderer = partial(render, self.config.executable, self.cache) # type: ignore

Expand Down

0 comments on commit fe534da

Please sign in to comment.