-
Notifications
You must be signed in to change notification settings - Fork 5
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
Fix sentry error #293
base: devel
Are you sure you want to change the base?
Fix sentry error #293
Conversation
openformats/formats/android.py
Outdated
@@ -382,7 +382,8 @@ def compile(self, template, stringset, is_source=True, language_info=None, | |||
|
|||
# This is needed in case the first tag is skipped to retain | |||
# the file's formating | |||
first_tag_position = parsed.text_position + len(parsed.text) | |||
parsed_text_length = len(parsed.text) if parsed.text else 0 |
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.
Actually both parsed.text and text_position are None
. Look:
In [41]: parsed.__dict__
Out[41]:
{'source': '<resources/>\n',
'start': 0,
'_position': 0,
'_tag': 'resources',
'_attrib': {},
'_attrib_string': '',
'_attributes': [],
'_text_position': None,
'_text': None,
'_content_end': openformats.utils.xml.NewDumbXml.NOT_CACHED,
'_tail_position': 12,
'_tail': openformats.utils.xml.NewDumbXml.NOT_CACHED}
In [40]: first_tag_position = parsed.text_position + 0
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In [40], line 1
----> 1 first_tag_position = parsed.text_position + 0
TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'
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.
As you see from the above dumped parsed
object the template is empty! The resource https://www.transifex.com/careem-1/ridehail-android/translate/#ur/features_ridehail_ui doesn't contain any strings. So I believe we are safe to put it like:
if parsed.text and parsed.text_position:
first_tag_position = parsed.text_position + len(parsed.text)
self.transcriber.copy_until(first_tag_position)
The rest of the compile()
method code will run without errors...
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.
Done
Problem and/or solution
fixes this sentry error: https://sentry.io/organizations/transifex/issues/2918954663/?referrer=slack
How to test
Reviewer checklist
Code:
PR: