Skip to content

Conversation

@lupengamzn
Copy link
Contributor

Issue #, if available:
#283
Description of changes:
Fixed serialization issue when cause is a str

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@michaelbrewer
Copy link

@lupengamzn when is the next planned release?

for throwable in value['exceptions']:
throwables.append(throwable.to_dict())
entity_dict[key]['exceptions'] = throwables
else:
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we check if the self.cause is a string before adding it to the entity_dict? This way if self.cause is neither a dict nor a string, we can just skip it and avoid adding something which may not be serializable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

cause can only be dict or string, as confirmed by doc and code. The other cases should be unlikely as SDK doesn't record types other than dict or string.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see. Then it should be fine. Thanks for confirming.

actual_segment_one_dict = entity_to_dict(segment_one)
actual_segment_two_dict = entity_to_dict(segment_two)

assert expected_segment_one_dict == actual_segment_one_dict
Copy link
Contributor

Choose a reason for hiding this comment

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

Not a big deal, but we should have two separate test cases since we are testing two different scenarios of exception chaining in the segments.

@lupengamzn lupengamzn merged commit e7711fe into aws:master Apr 21, 2021
Hargrav3s pushed a commit to Gavant/aws-xray-sdk-python that referenced this pull request Mar 22, 2022
Co-authored-by: Prashant Srivastava <[email protected]>
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