Skip to content

[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

Merged

Conversation

jonathan-buttner
Copy link
Contributor

@jonathan-buttner jonathan-buttner commented Jun 2, 2025

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)

@jonathan-buttner jonathan-buttner added :ml Machine learning Team:ML Meta label for the ML team auto-backport Automatically create backport pull requests when merged v8.19.0 v9.1.0 labels Jun 2, 2025
@jonathan-buttner jonathan-buttner marked this pull request as ready for review June 17, 2025 14:46
@elasticsearchmachine
Copy link
Collaborator

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)
Copy link
Member

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.

Copy link
Contributor Author

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 👍

Copy link
Member

@dan-rubinstein dan-rubinstein left a comment

Choose a reason for hiding this comment

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

LGTM

@jonathan-buttner jonathan-buttner enabled auto-merge (squash) June 17, 2025 20:09
Copy link
Member

@davidkyle davidkyle left a comment

Choose a reason for hiding this comment

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

LGTM

@jonathan-buttner jonathan-buttner enabled auto-merge (squash) June 18, 2025 14:10
@jonathan-buttner jonathan-buttner enabled auto-merge (squash) June 18, 2025 14:10
@jonathan-buttner jonathan-buttner merged commit f096773 into elastic:main Jun 18, 2025
27 checks passed
@jonathan-buttner jonathan-buttner deleted the cs-remove-error-parser branch June 18, 2025 14:11
@elasticsearchmachine
Copy link
Collaborator

💔 Backport failed

Status Branch Result
8.19 Commit could not be cherrypicked due to conflicts

You can use sqren/backport to manually backport by running backport --upstream elastic/elasticsearch --pr 128778

@jonathan-buttner
Copy link
Contributor Author

💚 All backports created successfully

Status Branch Result
8.19

Questions ?

Please refer to the Backport tool documentation

elasticsearchmachine pushed a commit that referenced this pull request Jun 18, 2025
…129638)

* Remove error parsing class

* Adding test for lack of error parsing logic

* Adding transport version check

* Wrapping string in try/catch and adding test

(cherry picked from commit f096773)

# Conflicts:
#	server/src/main/java/org/elasticsearch/TransportVersions.java
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Automatically create backport pull requests when merged backport pending :ml Machine learning >refactoring Team:ML Meta label for the ML team v8.19.0 v9.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants