Class ErrorResponse
- java.lang.Object
-
- org.apache.druid.error.ErrorResponse
-
public class ErrorResponse extends Object
A Response Object that represents an error to be returned over the wire. This object carries legacy bits to deal with compatibility issues of converging the error responses fromQueryExceptionwith the intended going-forward error responses fromDruidExceptionThe intent is that eventually
QueryExceptionis completely subsumed byDruidExceptionin which case the legacy bits of this class can hopefully also be removed.The intended long-term schema of output is an object that looks like
{ "errorCode": `a code string`, "persona": USER | ADMIN | OPERATOR | DEVELOPER "category": DEFENSIVE | INVALID_INPUT | UNAUTHORIZED | CAPACITY_EXCEEDED | CANCELED | RUNTIME_FAILURE | TIMEOUT | UNSUPPORTED | UNCATEGORIZED "errorMessage": `a message for the intended audience` "context": `a map of extra context values that might be helpful` }
In the interim, there are extra fields that also end up included so that the wire-schema can also be interpretted and handled by clients that are built assuming they are looking at QueryExceptions. These extra fields are
{ "error": `an error code from QueryException` | "druidException" "errorClass": `the error class, as used by QueryException` "host": `the host that the exception occurred on, as used by QueryException` }
These 3 top-level fields are deprecated and will eventually disappear from API responses. The values can, instead, be pulled from the context object of an "legacyQueryException" errorCode object. The field names in the context object map as follows * "error" -> "legacyErrorCode" * "errorClass" -> "errorClass" * "host" -> "host"
-
-
Constructor Summary
Constructors Constructor Description ErrorResponse(DruidException underlyingException)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ErrorResponsefromMap(Map<String,Object> map)Map<String,Object>getAsMap()DruidExceptiongetUnderlyingException()
-
-
-
Constructor Detail
-
ErrorResponse
public ErrorResponse(DruidException underlyingException)
-
-
Method Detail
-
fromMap
public static ErrorResponse fromMap(Map<String,Object> map)
-
getUnderlyingException
public DruidException getUnderlyingException()
-
-