-
Notifications
You must be signed in to change notification settings - Fork 25.3k
[ML] Remove error parsing functionality for custom service #128778
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
[ML] Remove error parsing functionality for custom service #128778
Conversation
Pinging @elastic/ml-core (Team:ML) |
public CustomResponseHandler(String requestType, ResponseParser parseFunction, ErrorResponseParser errorParser) { | ||
super(requestType, parseFunction, errorParser); | ||
private static final Function<HttpResult, ErrorResponse> ERROR_PARSER = (httpResult) -> new ErrorResponse( | ||
new String(httpResult.body(), StandardCharsets.UTF_8) |
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.
Is there any case where this might fail to parse and we'd want some sort of generic fallback string? From the java docs it seems "The behavior of this constructor when the given bytes are not valid in the given charset is unspecified." (here) so I'm not quite clear on how this might react if it can't parse the bytes.
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.
Yeah good point, I'll wrap it in a try/catch and return something generic 👍
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.
LGTM
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.
LGTM
💔 Backport failed
You can use sqren/backport to manually backport by running |
💚 All backports created successfully
Questions ?Please refer to the Backport tool documentation |
This PR addresses the feedback item from the original PR: #127939
This PR removes the error parsing functionality and instead converts the entire error to a string.
Comments:
#127939 (comment)