Skip to content

Commit

Permalink
Fix error message formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
davidkyle committed Sep 20, 2024
1 parent 109abdc commit f813111
Showing 1 changed file with 5 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@

public class ExceptionsHelper {

private static String NO_KNOWN_MODEL_ERROR =
"No known trained model with model_id [{}], you may need to create it or load it into the cluster with eland";

private ExceptionsHelper() {}

public static ResourceNotFoundException missingJobException(String jobId) {
Expand Down Expand Up @@ -51,19 +54,11 @@ public static ResourceNotFoundException missingModelDeployment(String deployment
}

public static ResourceNotFoundException missingTrainedModel(String modelId) {
return new ResourceNotFoundException(
"No known trained model with model_id [{}], you may need to create it or load it into the cluster with eland",
modelId
);
return new ResourceNotFoundException(NO_KNOWN_MODEL_ERROR, modelId);
}

public static ResourceNotFoundException missingTrainedModel(String modelId, Exception cause) {
return new ResourceNotFoundException(
"Failure due to [{}]. No known trained model with model_id [{}], "
+ "you may need to create it or load it into the cluster with eland",
cause,
modelId
);
return new ResourceNotFoundException(NO_KNOWN_MODEL_ERROR, cause, modelId);
}

public static ElasticsearchException serverError(String msg) {
Expand Down

0 comments on commit f813111

Please sign in to comment.