Skip to content
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

exception_level_filters: support string for filtered class name #38

Merged
merged 3 commits into from
Dec 9, 2014
Merged

exception_level_filters: support string for filtered class name #38

merged 3 commits into from
Dec 9, 2014

Conversation

asnyatkov
Copy link
Contributor

#37

Added ability to specify exception level filters using either string or class type.
Added unit test for exception_level_filters

@asnyatkov
Copy link
Contributor Author

Couple of general comments:

  • I chose to resolve classes lazily instead of doing it in rollbar.init to handle the case when exception module imported after rollbar inititialization, or it's done dynamically via import
  • If class name is not found within the module, it's just silently skipped. Probably it's better to fail - what do you think?

@@ -403,7 +403,16 @@ def prev_page(self):


def _filtered_level(exception):
for cls, level in SETTINGS['exception_level_filters']:
for i, item in enumerate(SETTINGS['exception_level_filters']):
cls, level = item
Copy link
Member

Choose a reason for hiding this comment

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

I think it might be a good idea to break the body of the for loop out into its own function. Otherwise the continue part of the logic is easy to overlook / a little hard to reason about (had me confused for a bit).

@brianr
Copy link
Member

brianr commented Dec 4, 2014

Thanks for the PR! I think the behavior as you implemented it is good. See a few comments above.

… import module 'exceptions' in unit test because it breaks compatibility with Python3
@brianr
Copy link
Member

brianr commented Dec 4, 2014

Looks good to me. @coryvirok can you review this as well?

@asnyatkov
Copy link
Contributor Author

Hey @coryvirok, do you think you will review and merge sometime this week?

@coryvirok
Copy link
Contributor

@asnyatkov I'm on it

@@ -401,10 +401,23 @@ def prev_page(self):

## internal functions

def _resolve_exception_class(idx, filter):
cls, level = filter
if isinstance(cls, str):
Copy link
Contributor

Choose a reason for hiding this comment

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

@coryvirok
Copy link
Contributor

This looks great! I'll merge once the basestring change is made.

Thanks!

@coryvirok
Copy link
Contributor

I'll just make the change myself so we can get this out.

coryvirok added a commit that referenced this pull request Dec 9, 2014
exception_level_filters: support string for filtered class name
@coryvirok coryvirok merged commit fbba9f1 into rollbar:master Dec 9, 2014
@asnyatkov
Copy link
Contributor Author

Super! Thanks!

@coryvirok
Copy link
Contributor

Alrighty, 0.9.3 is released on pypi

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.

3 participants