Skip to content

[BUG] MLSdkAsyncHttpResponseHandler reports incorrect generic MLException #4170

@brianf-aws

Description

@brianf-aws

What is the bug?
Currently Ml Commons reports a generic MLException which hides the error underneath

} catch (Exception e) {
log.error("Failed to process response body: {}", body, e);
actionListener.onFailure(new MLException("Fail to execute " + action + " in aws connector", e));
}

Our Application uses ML-Commons and extracts the response code from ML Commons in order to declare whether an error is a 5xx or 4xx usually this is done with OpenSearchStatusException.status().getStatus() And if it can't be parsed from said exception it reports as a 5xx. This step is incorrect and should instead capture the exception underneath so downstream clients can correctly decide what to do/report.

How can one reproduce the bug?
On a high level. Create a connector with a post processing function that will fail on the ml output
Steps to reproduce the behavior:

  1. Perform prediction
  2. Observe that the post processing fails and a MLException is reported. with IllegalArgumentException reported underneath

What is the expected behavior?
We want to be able to extract what occurred and be able to intelillegently parse what the error was as placing another branch in our application for if e instanceOf MLException then parseUntilGetErrorCode(e) would not be ideal.

As a form of mitigation we can catch the simple Client errors and report them back to the actionListener Instead


 } catch (IllegalArgumentException e) { 
     actionListener.onFailure(e); 
 } 

What is your host/environment?

  • OS: Mac
  • Version OS.2.17
  • Plugins

Do you have any screenshots?
If applicable, add screenshots to help explain your problem.

Do you have any additional context?
Add any other context about the problem.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions