Skip to content

Commit 6e06b9d

Browse files
authored
[M] Fix error message formatting (#113266)
Missing model id argument to the format string
1 parent 51570a0 commit 6e06b9d

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

docs/changelog/113266.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 113266
2+
summary: "[M] Fix error message formatting"
3+
area: Machine Learning
4+
type: bug
5+
issues: []

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/utils/ExceptionsHelper.java

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020

2121
public class ExceptionsHelper {
2222

23+
private static String NO_KNOWN_MODEL_ERROR =
24+
"No known trained model with model_id [{}], you may need to create it or load it into the cluster with eland";
25+
2326
private ExceptionsHelper() {}
2427

2528
public static ResourceNotFoundException missingJobException(String jobId) {
@@ -51,19 +54,11 @@ public static ResourceNotFoundException missingModelDeployment(String deployment
5154
}
5255

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

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

6964
public static ElasticsearchException serverError(String msg) {

0 commit comments

Comments
 (0)