-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
feat(pipeline): IE errors translation #6709
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
Conversation
504d3f1
to
2ddd59a
Compare
Generated by 🚫 danger |
@mitsuhiko @mattrobenolt all tests are passing locally, but I have some encoding issues when running pre-commit hook. Could you help me figure it out?
I also need a review of my last commit, as I'm not 100% sure if I handled encoding correctly. |
I’m not sure which tool, but one of the tools we use can’t handle utf-8 source code. So the test_errorlocale file is causing a problem. Just use the ascii escape sequences. I don’t have a better suggestion. :/ |
import io | ||
import re | ||
|
||
LOCALES_DIR = 'src/sentry/data/error-locale' |
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.
can we do os.path.join(os.path.dirname(__file__), '../../data/error-locale'
instead? Current working directory is unrealiable. You can see with other code how we do it.
# exact match | ||
translation_regexp = '^' + \ | ||
translation_regexp.replace( | ||
'\%s', '(?P<format_string_data>[a-zA-Z0-9-_\$]+)') + '$' |
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.
Can we change this from ''
to r''
? Right now this mostly works by accident.
|
||
# Handle both cases. Just a message and message preceeded with error type | ||
# eg. `ReferenceError: foo`, `TypeError: bar` | ||
match = re.match('^(?P<type>[a-zA-Z]*Error): (?P<message>.*)', message) |
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.
Please precompile this regex with re.compile
and stash it away instead of using re.match
. The regex cache on 2.7 is really bad. Also use regex.search
instead of regex.match
. The latter anchors.
37712d3
to
ab197e0
Compare
Merging this per @kamilogorek's request |
Locale files are taken from https://github.com/errorception/ie-error-languages