From 7e49d47391d17b411b0620794e503592d8f37481 Mon Sep 17 00:00:00 2001 From: Justin Borromeo Date: Tue, 12 Mar 2019 16:51:25 -0700 Subject: [PATCH] Added error message for UOE --- .../org/apache/druid/query/QueryInterruptedException.java | 5 ++++- .../apache/druid/query/QueryInterruptedExceptionTest.java | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/processing/src/main/java/org/apache/druid/query/QueryInterruptedException.java b/processing/src/main/java/org/apache/druid/query/QueryInterruptedException.java index 947a6566bdf..54bb132d79d 100644 --- a/processing/src/main/java/org/apache/druid/query/QueryInterruptedException.java +++ b/processing/src/main/java/org/apache/druid/query/QueryInterruptedException.java @@ -46,7 +46,8 @@ public class QueryInterruptedException extends RuntimeException public static final String QUERY_TIMEOUT = "Query timeout"; public static final String QUERY_CANCELLED = "Query cancelled"; public static final String RESOURCE_LIMIT_EXCEEDED = "Resource limit exceeded"; - public static final String UNAUTHORIZED = "Unauthorized request."; + public static final String UNAUTHORIZED = "Unauthorized request"; + public static final String UNSUPPORTED_OPERATION = "Unsupported operation"; public static final String UNKNOWN_EXCEPTION = "Unknown exception"; private final String errorCode; @@ -135,6 +136,8 @@ public class QueryInterruptedException extends RuntimeException return QUERY_TIMEOUT; } else if (e instanceof ResourceLimitExceededException) { return RESOURCE_LIMIT_EXCEEDED; + } else if (e instanceof UnsupportedOperationException) { + return UNSUPPORTED_OPERATION; } else { return UNKNOWN_EXCEPTION; } diff --git a/processing/src/test/java/org/apache/druid/query/QueryInterruptedExceptionTest.java b/processing/src/test/java/org/apache/druid/query/QueryInterruptedExceptionTest.java index ecfe3c08415..bf5d7a40549 100644 --- a/processing/src/test/java/org/apache/druid/query/QueryInterruptedExceptionTest.java +++ b/processing/src/test/java/org/apache/druid/query/QueryInterruptedExceptionTest.java @@ -22,6 +22,7 @@ package org.apache.druid.query; import com.fasterxml.jackson.databind.ObjectMapper; import com.google.common.base.Throwables; import org.apache.druid.java.util.common.ISE; +import org.apache.druid.java.util.common.UOE; import org.apache.druid.segment.TestHelper; import org.junit.Assert; import org.junit.Test; @@ -43,6 +44,7 @@ public class QueryInterruptedExceptionTest Assert.assertEquals("Query cancelled", new QueryInterruptedException(new CancellationException()).getErrorCode()); Assert.assertEquals("Query interrupted", new QueryInterruptedException(new InterruptedException()).getErrorCode()); Assert.assertEquals("Query timeout", new QueryInterruptedException(new TimeoutException()).getErrorCode()); + Assert.assertEquals("Unsupported operation", new QueryInterruptedException(new UOE("Unsupported")).getErrorCode()); Assert.assertEquals("Unknown exception", new QueryInterruptedException(null).getErrorCode()); Assert.assertEquals("Unknown exception", new QueryInterruptedException(new ISE("Something bad!")).getErrorCode()); Assert.assertEquals(