Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/changelog/123890.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 123890
summary: Do not let `ShardBulkInferenceActionFilter` unwrap / rewrap ESExceptions
area: Search
type: bug
issues: []
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

package org.elasticsearch.xpack.inference;

import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.ElasticsearchWrapperException;
import org.elasticsearch.ExceptionsHelper;
import org.elasticsearch.rest.RestStatus;

public class InferenceException extends ElasticsearchException implements ElasticsearchWrapperException {
public InferenceException(String message, Throwable cause, Object... args) {
super(message, cause, args);
}

@Override
public RestStatus status() {
return ExceptionsHelper.status(unwrapCause());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

package org.elasticsearch.xpack.inference.action.filter;

import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.ElasticsearchStatusException;
import org.elasticsearch.ExceptionsHelper;
import org.elasticsearch.ResourceNotFoundException;
Expand Down Expand Up @@ -46,6 +45,7 @@
import org.elasticsearch.xcontent.XContent;
import org.elasticsearch.xpack.core.XPackField;
import org.elasticsearch.xpack.core.inference.results.ChunkedInferenceError;
import org.elasticsearch.xpack.inference.InferenceException;
import org.elasticsearch.xpack.inference.mapper.SemanticTextField;
import org.elasticsearch.xpack.inference.mapper.SemanticTextFieldMapper;
import org.elasticsearch.xpack.inference.mapper.SemanticTextUtils;
Expand Down Expand Up @@ -290,7 +290,7 @@ public void onFailure(Exception exc) {
request.field
);
} else {
failure = new ElasticsearchException(
failure = new InferenceException(
"Error loading inference for inference id [{}] on field [{}]",
exc,
inferenceId,
Expand Down Expand Up @@ -319,7 +319,7 @@ public void onResponse(List<ChunkedInference> results) {
var acc = inferenceResults.get(request.index);
if (result instanceof ChunkedInferenceError error) {
acc.addFailure(
new ElasticsearchException(
new InferenceException(
"Exception when running inference id [{}] on field [{}]",
error.exception(),
inferenceProvider.model.getInferenceEntityId(),
Expand Down Expand Up @@ -351,7 +351,7 @@ public void onFailure(Exception exc) {
for (FieldInferenceRequest request : requests) {
addInferenceResponseFailure(
request.index,
new ElasticsearchException(
new InferenceException(
"Exception when running inference id [{}] on field [{}]",
exc,
inferenceProvider.model.getInferenceEntityId(),
Expand Down