Class UserException
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
UserRemoteException
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.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Builder class for DrillUserException. -
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
UserException
(UserBitShared.DrillPBError.ErrorType errorType, String message, Throwable cause) -
Method Summary
Modifier and TypeMethodDescriptionstatic UserException.Builder
Creates a new user exception builder.static UserException.Builder
connectionError
(Throwable cause) Wraps the passed exception inside a connection error.static UserException.Builder
Creates a new user exception builder.static UserException.Builder
dataReadError
(Throwable cause) Wraps the passed exception inside a data read error.static UserException.Builder
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
Creates a new user exception builder .static UserException.Builder
functionError
(Throwable cause) Wraps the passed exception inside a function error.generates the message that will be displayed to the client without the stack trace.getMessage
(boolean includeErrorIdAndIdentity) getOrCreatePBError
(boolean verbose) returns or creates a DrillPBError object corresponding to this user exception.generates the message that will be displayed to the client.getVerboseMessage
(boolean includeErrorIdAndIdentity) static UserException.Builder
static UserException.Builder
internalError
(Throwable cause) Indicates an internal validation failed or similar unexpected error.static UserException.Builder
Creates a RESOURCE error with a prebuilt message for out of memory exceptionsstatic 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 exceptionsstatic UserException.Builder
Creates a new user exception builder .static UserException.Builder
parseError
(Throwable cause) Wraps the passed exception inside a parse error.static UserException.Builder
creates a new user exception builder .static UserException.Builder
permissionError
(Throwable cause) Wraps the passed exception inside a permission error.static UserException.Builder
Creates a new user exception builder .static UserException.Builder
Wraps the passed exception inside a plan error.static UserException.Builder
pluginError
(Throwable cause) Wraps the passed exception inside a plugin error.rebuild()
static UserException.Builder
Creates a new user exception builder .static UserException.Builder
resourceError
(Throwable cause) Wraps the passed exception inside a resource error.static UserException.Builder
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
Creates a new user exception builder .static UserException.Builder
unsupportedError
(Throwable cause) Wraps the passed exception inside a unsupported error.static UserException.Builder
Creates a new user exception builder .static UserException.Builder
validationError
(Throwable cause) wraps the passed exception inside a validation error.Methods inherited from class org.apache.drill.common.exceptions.DrillRuntimeException
checkInterrupted, create, create
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Field Details
-
MEMORY_ERROR_MSG
- See Also:
-
-
Constructor Details
-
Method Details
-
memoryError
Creates a RESOURCE error with a prebuilt message for out of memory exceptions- Parameters:
cause
- exception that will be wrapped inside a memory error- Returns:
- resource error builder
-
memoryError
-
memoryError
Creates a RESOURCE error with a prebuilt message for out of memory exceptions- Returns:
- resource error builder
-
systemError
Wraps the passed exception inside a system error.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.- Parameters:
cause
- exception we want the user exception to wrap. If cause is, or wraps, a user exception it will be returned by the builder instead of creating a new user exception- Returns:
- user exception builder
- See Also:
-
connectionError
Creates a new user exception builder.- Returns:
- user exception builder
- See Also:
-
connectionError
Wraps the passed exception inside a connection error.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.- Parameters:
cause
- exception we want the user exception to wrap. If cause is, or wraps, a user exception it will be returned by the builder instead of creating a new user exception- Returns:
- user exception builder
- See Also:
-
dataReadError
Creates a new user exception builder.- Returns:
- user exception builder
- See Also:
-
dataReadError
Wraps the passed exception inside a data read error.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.- Parameters:
cause
- exception we want the user exception to wrap. If cause is, or wraps, a user exception it will be returned by the builder instead of creating a new user exception- Returns:
- user exception builder
- See Also:
-
dataWriteError
Creates a new user exception builder .- Returns:
- user exception builder
- See Also:
-
dataWriteError
Wraps the passed exception inside a data write error.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.- Parameters:
cause
- exception we want the user exception to wrap. If cause is, or wraps, a user exception it will be returned by the builder instead of creating a new user exception- Returns:
- user exception builder
- See Also:
-
functionError
Creates a new user exception builder .- Returns:
- user exception builder
- See Also:
-
functionError
Wraps the passed exception inside a function error.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.- Parameters:
cause
- exception we want the user exception to wrap. If cause is, or wraps, a user exception it will be returned by the builder instead of creating a new user exception- Returns:
- user exception builder
- See Also:
-
parseError
Creates a new user exception builder .- Returns:
- user exception builder
- See Also:
-
parseError
Wraps the passed exception inside a parse error.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.- Parameters:
cause
- exception we want the user exception to wrap. If cause is, or wraps, a user exception it will be returned by the builder instead of creating a new user exception- Returns:
- user exception builder
- See Also:
-
validationError
Creates a new user exception builder .- Returns:
- user exception builder
- See Also:
-
validationError
wraps the passed exception inside a validation error.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.- Parameters:
cause
- exception we want the user exception to wrap. If cause is, or wraps, a user exception it will be returned by the builder instead of creating a new user exception- Returns:
- user exception builder
- See Also:
-
permissionError
creates a new user exception builder .- Returns:
- user exception builder
- See Also:
-
permissionError
Wraps the passed exception inside a permission error.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.- Parameters:
cause
- exception we want the user exception to wrap. If cause is, or wraps, a user exception it will be returned by the builder instead of creating a new user exception- Returns:
- user exception builder
- See Also:
-
planError
Creates a new user exception builder .- Returns:
- user exception builder
- See Also:
-
planError
Wraps the passed exception inside a plan error.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.- Parameters:
cause
- exception we want the user exception to wrap. If cause is, or wraps, a user exception it will be returned by the builder instead of creating a new user exception- Returns:
- user exception builder
- See Also:
-
pluginError
Wraps the passed exception inside a plugin error.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.- Parameters:
cause
- exception we want the user exception to wrap. If cause is, or wraps, a user exception it will be returned by the builder instead of creating a new user exception- Returns:
- user exception builder
- See Also:
-
resourceError
Creates a new user exception builder .- Returns:
- user exception builder
- See Also:
-
resourceError
Wraps the passed exception inside a resource error.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.- Parameters:
cause
- exception we want the user exception to wrap. If cause is, or wraps, a user exception it will be returned by the builder instead of creating a new user exception- Returns:
- user exception builder
- See Also:
-
unsupportedError
Creates a new user exception builder .- Returns:
- user exception builder
- See Also:
-
unsupportedError
Wraps the passed exception inside a unsupported error.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.- Parameters:
cause
- exception we want the user exception to wrap. If cause is, or wraps, a user exception it will be returned by the builder instead of creating a new user exception- Returns:
- user exception builder
- See Also:
-
schemaChangeError
Report an unsupported schema change.- Parameters:
cause
- the SchemaChangeException. (Not typed because that class is not visible to this package.)- Returns:
- user exception builder.
-
schemaChangeError
-
executionError
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.- Parameters:
cause
- exception we want the user exception to wrap. If cause is, or wraps, a user exception it will be returned by the builder instead of creating a new user exception- Returns:
- user exception builder
-
internalError
Indicates an internal validation failed or similar unexpected error. Indicates the problem is likely within Drill itself rather than due to the environment, query, etc.- Parameters:
cause
- exception we want the user exception to wrap. If cause is, or wraps, a user exception it will be returned by the builder instead of creating a new user exception- Returns:
- user exception builder
-
internalError
-
unspecifiedError
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. In practice, using this exception indicates that error handling should be moved closer to the source of the exception so we can provide the user with a better explanation than "something went wrong."- Parameters:
cause
- exception we want the user exception to wrap. If cause is, or wraps, a user exception it will be returned by the builder instead of creating a new user exception- Returns:
- user exception builder
-
rebuild
-
getMessage
generates the message that will be displayed to the client without the stack trace.- Overrides:
getMessage
in classThrowable
- Returns:
- non verbose error message
-
getMessage
-
getOriginalMessage
- Returns:
- the error message that was passed to the builder
-
getVerboseMessage
generates the message that will be displayed to the client. The message also contains the stack trace.- Returns:
- verbose error message
-
getVerboseMessage
-
getOrCreatePBError
returns or creates a DrillPBError object corresponding to this user exception.- Parameters:
verbose
- should the error object contain the verbose error message ?- Returns:
- protobuf error object
-
getErrorId
-
getErrorType
-
getErrorLocation
-