-
Notifications
You must be signed in to change notification settings - Fork 24.6k
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
Retain exception fields in deserialization #49278
Conversation
Pinging @elastic/es-distributed (:Distributed/Reindex) |
@ywelsch @henningandersen This is a POC of how we could retain the information between deserializing a exception from reindexing and deserializing it for http response. |
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.
I think this looks like the right direction. I left a few comments to consider/discuss.
server/src/main/java/org/elasticsearch/ElasticsearchException.java
Outdated
Show resolved
Hide resolved
@@ -1182,4 +1226,18 @@ private static String toUnderscoreCase(String value) { | |||
return sb.toString(); | |||
} | |||
|
|||
private static class XContentRetainingException extends ElasticsearchException { | |||
|
|||
private final String fromXContentExceptionType; |
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.
Would be nice to also return this type from the static getExceptionName
method.
server/src/test/java/org/elasticsearch/ElasticsearchExceptionTests.java
Outdated
Show resolved
Hide resolved
Added xcontent serialization tests for ReindexTaskStateDoc Related to elastic#42612 Depends on elastic#49278 (todo)
In ElasticsearchException
type
,reason
, andstacktrace
areserialized to xcontent. However, when the xcontent is deserialized
these fields are lost. This PR adds a method that will optionally retain
these fields for usage when the exception is serialized a second time.