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

Better exception email parsing #25

Merged
merged 2 commits into from
Oct 12, 2020
Merged

Conversation

waltjones
Copy link
Contributor

@waltjones waltjones commented Oct 6, 2020

Description of the change

This PR bundles fixes for several reported issues with exception email parsing.

  • Allow/Expect multiple lines of context before the cause line.
  • Allow Arbitrary number of lines (or none) before the user/org line.
  • Allow omitted stack lines.
  • In general, don't depend on specific/magic line numbers.

This PR also gracefully handles regex matching groups not found, and lineno/colno not found.

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Related issues

Fixes ch73726, ch72277

Development

  • Lint rules pass locally
  • The code changed/added as part of this pull request has been covered with tests
  • All tests related to the changed code pass in development

Code review

  • This pull request has a descriptive title and information useful to a reviewer. There may be a screenshot or screencast attached
  • "Ready for review" label attached to the PR and reviewers mentioned in a comment
  • Changes have been reviewed by at least one other engineer
  • Issue from task tracker has a link to this pull request

@waltjones waltjones changed the title WIP: Better exception email parsing Better exception email parsing Oct 6, 2020
@waltjones waltjones closed this Oct 6, 2020
@waltjones waltjones reopened this Oct 6, 2020
Copy link
Contributor

@mrunalk mrunalk left a comment

Choose a reason for hiding this comment

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

Interesting problem and interesting solution. :)


public static Integer parseLine(String emailBody) {
return Integer.valueOf(parseContent(
public static Integer parseLineno(String line) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor Style fix: should be "parseLineNo"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was about to make this change throughout the code, but then noticed the Rollbar API uses lineno and colno with lowercase n and no underscore before the lowercase n. Then I was curious about usage in general, across languages, and it seems pretty well split between people using uppercase or lowercase n.

For consistency with the use of lineno and colno in the code I'm inclined to keep this as is.

@waltjones waltjones merged commit a09fe30 into master Oct 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants