Skip to content

Conversation

@oliverb123
Copy link
Contributor

No description provided.

@oliverb123 oliverb123 changed the title fix(): add synthetic exception, use it to prevent attributeerrors fix(err): add synthetic exception, use it to prevent attributeerrors Jun 13, 2025
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

Introduces a new SyntheticException wrapper class to standardize exception handling and prevent AttributeErrors when working with raw exception tuples.

  • Added posthog/synthetic_exception.py to provide a consistent interface for exception data with proper attribute handling
  • Modified exception_utils.py to support synthetic exceptions in exception info processing
  • Updated exception handlers in exception_capture.py to wrap raw exception tuples with SyntheticException
  • Ensures proper handling of __traceback__ attribute across all exception scenarios

3 files reviewed, 2 comments
Edit PR Review Bot Settings | Greptile

@@ -0,0 +1,14 @@
class SyntheticException(BaseException):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Consider inheriting from Exception instead of BaseException. BaseException is typically reserved for system exits and keyboard interrupts.

Suggested change
class SyntheticException(BaseException):
class SyntheticException(Exception):

Comment on lines +11 to +14
if exc_value:
super().__init__(str(exc_value))
else:
super().__init__(f"{exc_type.__name__}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Consider using a more descriptive message format that includes both type and value when available: f"{exc_type.name}: {exc_value if exc_value else ''}"

@oliverb123
Copy link
Contributor Author

Closed in favour of #261

@oliverb123 oliverb123 closed this Jun 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants