Skip to content

Commit

Permalink
Fixed Security Exceptions For Requests Wihtout PPL Access
Browse files Browse the repository at this point in the history
Signed-off-by: Vamsi Manohar <reddyvam@amazon.com>
  • Loading branch information
vamsi-amazon committed Aug 29, 2023
1 parent 627189b commit f03a9ea
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import java.util.function.Supplier;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.opensearch.OpenSearchException;
import org.opensearch.client.node.NodeClient;
import org.opensearch.core.action.ActionListener;
import org.opensearch.core.rest.RestStatus;
Expand Down Expand Up @@ -134,6 +135,9 @@ public void onFailure(Exception e) {
"Failed to explain the query due to error: " + e.getMessage());
} else if (e instanceof IllegalAccessException) {
reportError(channel, e, BAD_REQUEST);
} else if (e instanceof OpenSearchException) {
OpenSearchException exception = (OpenSearchException) e;
reportError(channel, exception, exception.status());
} else {
LOG.error("Error happened during query handling", e);
if (isClientError(e)) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
package org.opensearch.sql.prometheus.exceptions;public class PrometheusClientException {

Check warning on line 1 in prometheus/src/main/java/org/opensearch/sql/prometheus/exceptions/PrometheusClientException.java

View check run for this annotation

Codecov / codecov/patch

prometheus/src/main/java/org/opensearch/sql/prometheus/exceptions/PrometheusClientException.java#L1

Added line #L1 was not covered by tests
}

0 comments on commit f03a9ea

Please sign in to comment.