diff options
author | John L. Villalovos <john@sodarock.com> | 2022-06-25 10:02:53 -0700 |
---|---|---|
committer | John L. Villalovos <john@sodarock.com> | 2022-06-25 10:02:53 -0700 |
commit | 7577c91c5819c8f37acbf4d4c3eee3ffd84522a0 (patch) | |
tree | c48fc0d5263ed1956b2febee96bab4d5ad323b6f /gitlab/exceptions.py | |
parent | f9b7c7b5c1c5782ffe1cec19420f3484681e1a67 (diff) | |
download | gitlab-jlvillal/version_in_keyerror.tar.gz |
chore: add the version of python-gitlab to GitlabErrorjlvillal/version_in_keyerror
People will post tracebacks of exceptions but not post information on
the version of python-gitlab used.
Add the version of python-gitlab to the GitlabError exception message.
Diffstat (limited to 'gitlab/exceptions.py')
-rw-r--r-- | gitlab/exceptions.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/gitlab/exceptions.py b/gitlab/exceptions.py index 8465838..b39dfc2 100644 --- a/gitlab/exceptions.py +++ b/gitlab/exceptions.py @@ -18,6 +18,10 @@ import functools from typing import Any, Callable, cast, Optional, Type, TYPE_CHECKING, TypeVar, Union +from . import _version as _gl_version + +_PG_VERSION = f" (python-gitlab version: {_gl_version.__version__})" + class GitlabError(Exception): def __init__( @@ -27,6 +31,10 @@ class GitlabError(Exception): response_body: Optional[bytes] = None, ) -> None: + if isinstance(error_message, str): + error_message += _PG_VERSION + else: + error_message += bytes(_PG_VERSION, encoding="ascii") Exception.__init__(self, error_message) # Http status code self.response_code = response_code |