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

Refactor ServerError, Error and ErrorCause #3677

Merged
merged 5 commits into from
May 2, 2019
Merged

Refactor ServerError, Error and ErrorCause #3677

merged 5 commits into from
May 2, 2019

Conversation

russcam
Copy link
Contributor

@russcam russcam commented Apr 17, 2019

With both the low level client and high level client now using the same internal serializer, the deserialization of ServerError, Error and ErrorCause can be simplified.

ErrorCauseMetadata is removed from ErrorCause, and the properties it contains are hoisted onto ErrorCause. It is possible that the JSON for and error cause contains properties that are not mapped on ErrorCause. Currently, these will be ignored. If we feel it is worthwhile, we could also capture these too, by implementing ErrorCause as a dictionary with a formatter to deserialize and set known values

With both the low level client and high level client now using the same internal serializer, the deserialization of ServerError, Error and ErrorCause can be simplified. ErrorCauseMetadata is removed from ErrorCause, and the properties it contains are hoisted onto ErrorCause. It is possible that the JSON for and error cause contains properties that are not mapped on ErrorCause. Currently, these will be ignored. If we fill it is worthwhile, we could also capture these.
@Mpdreamz
Copy link
Member

we could also capture these too, by implementing ErrorCause as a dictionary with a formatter to deserialize and set known values

Relates to elastic/elasticsearch#27672

I'd be +1 to rework ErrorCause into a dictionary as a long term plan. Let's track this in a separate issue though.

@@ -209,7 +209,7 @@ protected override void ExpectResponse(IDeleteByQueryResponse response)
failure.Id.Should().NotBeNullOrWhiteSpace();

failure.Cause.Should().NotBeNull();
failure.Cause.IndexUniqueId.Should().NotBeNullOrWhiteSpace();
failure.Cause.IndexUUID.Should().NotBeNullOrWhiteSpace();
Copy link
Member

Choose a reason for hiding this comment

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

👍

This commit refactors Error and ErrorCause to deserialize known fields to properties and unknown
properties into key/value pairs in AddtionalProperties.
@russcam russcam merged commit 25aa449 into 7.x May 2, 2019
@russcam russcam deleted the 7x/refactor-errors branch May 10, 2019 03:28
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.

2 participants