-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extracts classes bases with module names and self name, add them to tags #61
Conversation
python/humbug/report.py
Outdated
@@ -87,6 +87,20 @@ def __init__( | |||
self.is_excepthook_set = False | |||
self.is_loggerhook_set = False | |||
|
|||
def _extract_error_base(self, error: Exception) -> List[str]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not the core functionality we require - this can be an optional parameter in error_report
- in case a user wants to add a tag with exception base classes.
You should modify this function to return exception base classes up to a fixed recursion depth - some projects can have complicated exception class hierarchies.
Might be good to use error_type: type
instead of error: Exception
. You can do everything you need with the class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might use this in the future. I suggest tagging this commit so that we can cherry pick into future work.
python/humbug/report.py
Outdated
|
||
error_bases = self._extract_error_base(error=error) | ||
for error_base in error_bases: | ||
tags.append("error:{}".format(error_base)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need the base class of hte exception here. I suggest you do:
tags.extend(["error:{}".format(error.__class__.name), "error:{}.{}".format(error.__module__, error.__class__.__name__)])
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can skip the first item (without __module__
) if it makes sense.
python/humbug/report.py
Outdated
tags.extend(["type:error", "error:{}".format(error.__class__.__name__)]) | ||
try: | ||
tags.append( | ||
"moduleerror:{}.{}".format(error.__module__, error.__class__.__name__), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
error:full:PersonalException
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
It solves issue #56