diff --git a/CHANGELOG.md b/CHANGELOG.md index 006dac68..92a0a87e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 5.3.0 - 2025-06-19 + +- fix: safely handle exception values + # 5.2.0 - 2025-06-19 - feat: construct artificial stack traces if no traceback is available on a captured exception diff --git a/posthog/exception_utils.py b/posthog/exception_utils.py index 62e804b6..cac9ee05 100644 --- a/posthog/exception_utils.py +++ b/posthog/exception_utils.py @@ -438,12 +438,14 @@ def get_errno(exc_value): def get_error_message(exc_value): # type: (Optional[BaseException]) -> str - return ( + message = ( getattr(exc_value, "message", "") or getattr(exc_value, "detail", "") - or safe_str(exc_value) + or exc_value ) + return safe_str(message) + def single_exception_from_error_tuple( exc_type, # type: Optional[type] diff --git a/posthog/version.py b/posthog/version.py index 96d5127c..4e98cf35 100644 --- a/posthog/version.py +++ b/posthog/version.py @@ -1,4 +1,4 @@ -VERSION = "5.2.0" +VERSION = "5.3.0" if __name__ == "__main__": print(VERSION, end="") # noqa: T201