Skip to content

Commit

Permalink
fix: do not crash if pubsublite distribution can not be found when ex…
Browse files Browse the repository at this point in the history
…tracting semver (#120)

* feat: adding ability to create subscriptions at head

* fix: lint errors

* fix: remove absl dependency

* fix: lint

* feat: use default keyword args

* fix: rename offset location to backlog location

* fix: broken samples

* fix: do not crash if pubsublite distribution can not be found when extracting semver
  • Loading branch information
hannahrogers-google committed Apr 21, 2021
1 parent d7ee309 commit 811434e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion google/cloud/pubsublite/internal/wire/pubsub_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,13 @@ class _Semver(NamedTuple):


def _version() -> _Semver:
version = pkg_resources.get_distribution("google-cloud-pubsublite").version
try:
version = pkg_resources.get_distribution("google-cloud-pubsublite").version
except pkg_resources.DistributionNotFound:
_LOGGER.info(
"Failed to extract the google-cloud-pubsublite semver version. DistributionNotFound."
)
return _Semver(0, 0)
splits = version.split(".")
if len(splits) != 3:
_LOGGER.info(f"Failed to extract semver from {version}.")
Expand Down

0 comments on commit 811434e

Please sign in to comment.