public class UserException extends DrillRuntimeException
Throwing a user exception will guarantee it's message will be displayed to the user, along with any context information added to the exception at various levels while being sent to the client.
A specific class of user exceptions are system exception. They represent system level errors that don't display any specific error message to the user apart from "A system error has occurred" along with information to retrieve the details of the exception from the logs.
Although system exception should only display a generic message to the user, for now they will display the root error message, until all user errors are properly sent from the server side.
Any thrown exception that is not wrapped inside a user exception will automatically be converted to a system exception before being sent to the client.
| Modifier and Type | Class and Description |
|---|---|
static class |
UserException.Builder
Builder class for DrillUserException.
|
| Modifier and Type | Field and Description |
|---|---|
static String |
MEMORY_ERROR_MSG |
| Modifier | Constructor and Description |
|---|---|
protected |
UserException(UserBitShared.DrillPBError.ErrorType errorType,
String message,
Throwable cause) |
| Modifier and Type | Method and Description |
|---|---|
static UserException.Builder |
connectionError()
Creates a new user exception builder.
|
static UserException.Builder |
connectionError(Throwable cause)
Wraps the passed exception inside a connection error.
|
static UserException.Builder |
dataReadError()
Creates a new user exception builder.
|
static UserException.Builder |
dataReadError(Throwable cause)
Wraps the passed exception inside a data read error.
|
static UserException.Builder |
dataWriteError()
Creates a new user exception builder .
|
static UserException.Builder |
dataWriteError(Throwable cause)
Wraps the passed exception inside a data write error.
|
static UserException.Builder |
executionError(Throwable cause)
Wraps an error that arises from execution due to issues in the query, in
the environment and so on -- anything other than "this should never occur"
type checks.
|
static UserException.Builder |
functionError()
Creates a new user exception builder .
|
static UserException.Builder |
functionError(Throwable cause)
Wraps the passed exception inside a function error.
|
String |
getErrorId() |
String |
getErrorLocation() |
UserBitShared.DrillPBError.ErrorType |
getErrorType() |
String |
getMessage()
generates the message that will be displayed to the client without the stack trace.
|
String |
getMessage(boolean includeErrorIdAndIdentity) |
UserBitShared.DrillPBError |
getOrCreatePBError(boolean verbose)
returns or creates a DrillPBError object corresponding to this user exception.
|
String |
getOriginalMessage() |
String |
getVerboseMessage()
generates the message that will be displayed to the client.
|
String |
getVerboseMessage(boolean includeErrorIdAndIdentity) |
static UserException.Builder |
internalError() |
static UserException.Builder |
internalError(Throwable cause)
Indicates an internal validation failed or similar unexpected error.
|
static UserException.Builder |
memoryError()
Creates a RESOURCE error with a prebuilt message for out of memory exceptions
|
static UserException.Builder |
memoryError(String format,
Object... args) |
static UserException.Builder |
memoryError(Throwable cause)
Creates a RESOURCE error with a prebuilt message for out of memory exceptions
|
static UserException.Builder |
parseError()
Creates a new user exception builder .
|
static UserException.Builder |
parseError(Throwable cause)
Wraps the passed exception inside a parse error.
|
static UserException.Builder |
permissionError()
creates a new user exception builder .
|
static UserException.Builder |
permissionError(Throwable cause)
Wraps the passed exception inside a permission error.
|
static UserException.Builder |
planError()
Creates a new user exception builder .
|
static UserException.Builder |
planError(Throwable cause)
Wraps the passed exception inside a plan error.
|
UserException.Builder |
rebuild() |
static UserException.Builder |
resourceError()
Creates a new user exception builder .
|
static UserException.Builder |
resourceError(Throwable cause)
Wraps the passed exception inside a resource error.
|
static UserException.Builder |
schemaChangeError() |
static UserException.Builder |
schemaChangeError(Throwable cause)
Report an unsupported schema change.
|
static UserException.Builder |
systemError(Throwable cause)
Wraps the passed exception inside a system error.
|
static UserException.Builder |
unspecifiedError(Throwable cause)
Indicates an unspecified error: code caught the exception, but does not have
visibility into the cause well enough to pick one of the more specific
error types.
|
static UserException.Builder |
unsupportedError()
Creates a new user exception builder .
|
static UserException.Builder |
unsupportedError(Throwable cause)
Wraps the passed exception inside a unsupported error.
|
static UserException.Builder |
validationError()
Creates a new user exception builder .
|
static UserException.Builder |
validationError(Throwable cause)
wraps the passed exception inside a validation error.
|
checkInterrupted, create, createaddSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toStringpublic static final String MEMORY_ERROR_MSG
protected UserException(UserBitShared.DrillPBError.ErrorType errorType, String message, Throwable cause)
public static UserException.Builder memoryError(Throwable cause)
cause - exception that will be wrapped inside a memory errorpublic static UserException.Builder memoryError(String format, Object... args)
public static UserException.Builder memoryError()
public static UserException.Builder systemError(Throwable cause)
The cause message will be used unless UserException.Builder.message(String, Object...) is called.
If the wrapped exception is, or wraps, a user exception it will be returned by UserException.Builder.build(Logger)
instead of creating a new exception. Any added context will be added to the user exception as well.
cause - exception we want the user exception to wrap. If cause is, or wrap, a user exception it will be
returned by the builder instead of creating a new user exceptionUserBitShared.DrillPBError.ErrorType.SYSTEMpublic static UserException.Builder connectionError()
UserBitShared.DrillPBError.ErrorType.CONNECTIONpublic static UserException.Builder connectionError(Throwable cause)
The cause message will be used unless UserException.Builder.message(String, Object...) is called.
If the wrapped exception is, or wraps, a user exception it will be returned by UserException.Builder.build(Logger)
instead of creating a new exception. Any added context will be added to the user exception as well.
cause - exception we want the user exception to wrap. If cause is, or wrap, a user exception it will be
returned by the builder instead of creating a new user exceptionUserBitShared.DrillPBError.ErrorType.CONNECTIONpublic static UserException.Builder dataReadError()
UserBitShared.DrillPBError.ErrorType.DATA_READpublic static UserException.Builder dataReadError(Throwable cause)
The cause message will be used unless UserException.Builder.message(String, Object...) is called.
If the wrapped exception is, or wraps, a user exception it will be returned by UserException.Builder.build(Logger)
instead of creating a new exception. Any added context will be added to the user exception as well.
cause - exception we want the user exception to wrap. If cause is, or wrap, a user exception it will be
returned by the builder instead of creating a new user exceptionUserBitShared.DrillPBError.ErrorType.DATA_READpublic static UserException.Builder dataWriteError()
UserBitShared.DrillPBError.ErrorType.DATA_WRITEpublic static UserException.Builder dataWriteError(Throwable cause)
The cause message will be used unless UserException.Builder.message(String, Object...) is called.
If the wrapped exception is, or wraps, a user exception it will be returned by UserException.Builder.build(Logger)
instead of creating a new exception. Any added context will be added to the user exception as well.
cause - exception we want the user exception to wrap. If cause is, or wrap, a user exception it will be
returned by the builder instead of creating a new user exceptionUserBitShared.DrillPBError.ErrorType.DATA_WRITEpublic static UserException.Builder functionError()
UserBitShared.DrillPBError.ErrorType.FUNCTIONpublic static UserException.Builder functionError(Throwable cause)
The cause message will be used unless UserException.Builder.message(String, Object...) is called.
If the wrapped exception is, or wraps, a user exception it will be returned by UserException.Builder.build(Logger)
instead of creating a new exception. Any added context will be added to the user exception as well.
cause - exception we want the user exception to wrap. If cause is, or wrap, a user exception it will be
returned by the builder instead of creating a new user exceptionUserBitShared.DrillPBError.ErrorType.FUNCTIONpublic static UserException.Builder parseError()
UserBitShared.DrillPBError.ErrorType.PARSEpublic static UserException.Builder parseError(Throwable cause)
The cause message will be used unless UserException.Builder.message(String, Object...) is called.
If the wrapped exception is, or wraps, a user exception it will be returned by UserException.Builder.build(Logger)
instead of creating a new exception. Any added context will be added to the user exception as well.
cause - exception we want the user exception to wrap. If cause is, or wrap, a user exception it will be
returned by the builder instead of creating a new user exceptionUserBitShared.DrillPBError.ErrorType.PARSEpublic static UserException.Builder validationError()
UserBitShared.DrillPBError.ErrorType.VALIDATIONpublic static UserException.Builder validationError(Throwable cause)
the cause message will be used unless UserException.Builder.message(String, Object...) is called.
if the wrapped exception is, or wraps, a user exception it will be returned by UserException.Builder.build(Logger)
instead of creating a new exception. Any added context will be added to the user exception as well.
cause - exception we want the user exception to wrap. If cause is, or wrap, a user exception it will be
returned by the builder instead of creating a new user exceptionUserBitShared.DrillPBError.ErrorType.VALIDATIONpublic static UserException.Builder permissionError()
UserBitShared.DrillPBError.ErrorType.PERMISSIONpublic static UserException.Builder permissionError(Throwable cause)
The cause message will be used unless UserException.Builder.message(String, Object...) is called.
If the wrapped exception is, or wraps, a user exception it will be returned by UserException.Builder.build(Logger)
instead of creating a new exception. Any added context will be added to the user exception as well.
cause - exception we want the user exception to wrap. If cause is, or wrap, a user exception it will be
returned by the builder instead of creating a new user exceptionUserBitShared.DrillPBError.ErrorType.PERMISSIONpublic static UserException.Builder planError()
UserBitShared.DrillPBError.ErrorType.PLANpublic static UserException.Builder planError(Throwable cause)
The cause message will be used unless UserException.Builder.message(String, Object...) is called.
If the wrapped exception is, or wraps, a user exception it will be returned by UserException.Builder.build(Logger)
instead of creating a new exception. Any added context will be added to the user exception as well.
cause - exception we want the user exception to wrap. If cause is, or wrap, a user exception it will be
returned by the builder instead of creating a new user exceptionUserBitShared.DrillPBError.ErrorType.PLANpublic static UserException.Builder resourceError()
UserBitShared.DrillPBError.ErrorType.RESOURCEpublic static UserException.Builder resourceError(Throwable cause)
The cause message will be used unless UserException.Builder.message(String, Object...) is called.
If the wrapped exception is, or wraps, a user exception it will be returned by UserException.Builder.build(Logger)
instead of creating a new exception. Any added context will be added to the user exception as well.
cause - exception we want the user exception to wrap. If cause is, or wrap, a user exception it will be
returned by the builder instead of creating a new user exceptionUserBitShared.DrillPBError.ErrorType.RESOURCEpublic static UserException.Builder unsupportedError()
UserBitShared.DrillPBError.ErrorType.UNSUPPORTED_OPERATIONpublic static UserException.Builder unsupportedError(Throwable cause)
The cause message will be used unless UserException.Builder.message(String, Object...) is called.
If the wrapped exception is, or wraps, a user exception it will be returned by UserException.Builder.build(Logger)
instead of creating a new exception. Any added context will be added to the user exception as well.
cause - exception we want the user exception to wrap. If cause is, or wrap, a user exception it will be
returned by the builder instead of creating a new user exceptionUserBitShared.DrillPBError.ErrorType.UNSUPPORTED_OPERATIONpublic static UserException.Builder schemaChangeError(Throwable cause)
cause - the SchemaChangeException. (Not typed because that
class is not visible to this package.)public static UserException.Builder schemaChangeError()
public static UserException.Builder executionError(Throwable cause)
cause - exception we want the user exception to wrap. If cause is, or wrap, a user exception it will be
returned by the builder instead of creating a new user exceptionpublic static UserException.Builder internalError(Throwable cause)
cause - exception we want the user exception to wrap. If cause is, or wrap, a user exception it will be
returned by the builder instead of creating a new user exceptionpublic static UserException.Builder internalError()
public static UserException.Builder unspecifiedError(Throwable cause)
cause - exception we want the user exception to wrap. If cause is, or wrap, a user exception it will be
returned by the builder instead of creating a new user exceptionpublic UserException.Builder rebuild()
public String getMessage()
getMessage in class Throwablepublic String getMessage(boolean includeErrorIdAndIdentity)
public String getOriginalMessage()
public String getVerboseMessage()
public String getVerboseMessage(boolean includeErrorIdAndIdentity)
public UserBitShared.DrillPBError getOrCreatePBError(boolean verbose)
verbose - should the error object contain the verbose error message ?public String getErrorId()
public UserBitShared.DrillPBError.ErrorType getErrorType()
public String getErrorLocation()
Copyright © 2021 The Apache Software Foundation. All rights reserved.