mirror of https://github.com/apache/druid.git
Added better QueryInterruptedException error message for UnsupportedOperationException (#7248)
* Added error message for UOE * Updated docs * Doc change * Doc change
This commit is contained in:
parent
5294277cb4
commit
c7fea6ac8f
|
@ -122,4 +122,5 @@ Possible codes for the *error* field include:
|
|||
|`Query cancelled`|The query was cancelled through the query cancellation API.|
|
||||
|`Resource limit exceeded`|The query exceeded a configured resource limit (e.g. groupBy maxResults).|
|
||||
|`Unauthorized request.`|The query was denied due to security policy. Either the user was not recognized, or the user was recognized but does not have access to the requested resource.|
|
||||
|`Unsupported operation`|The query attempted to perform an unsupported operation. This may occur when using undocumented features or when using an incompletely implemented extension.|
|
||||
|`Unknown exception`|Some other exception occurred. Check errorMessage and errorClass for details, although keep in mind that the contents of those fields are free-form and may change from release to release.|
|
||||
|
|
|
@ -32,7 +32,8 @@ import java.util.concurrent.TimeoutException;
|
|||
*
|
||||
* Fields:
|
||||
* - "errorCode" is a well-defined errorCode code taken from a specific list (see the static constants). "Unknown exception"
|
||||
* represents all wrapped exceptions other than interrupt/timeout/cancellation.
|
||||
* represents all wrapped exceptions other than interrupt, timeout, cancellation, resource limit exceeded, unauthorized
|
||||
* request, and unsupported operation.
|
||||
* - "errorMessage" is the toString of the wrapped exception
|
||||
* - "errorClass" is the class of the wrapped exception
|
||||
* - "host" is the host that the errorCode occurred on
|
||||
|
@ -47,6 +48,7 @@ public class QueryInterruptedException extends RuntimeException
|
|||
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 UNSUPPORTED_OPERATION = "Unsupported operation";
|
||||
public static final String UNKNOWN_EXCEPTION = "Unknown exception";
|
||||
|
||||
private final String errorCode;
|
||||
|
@ -135,6 +137,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;
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ package org.apache.druid.query;
|
|||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
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;
|
||||
|
@ -42,6 +43,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(
|
||||
|
|
Loading…
Reference in New Issue