Class UserException.Builder
java.lang.Object
org.apache.drill.common.exceptions.UserException.Builder
- Enclosing class:
- UserException
Builder class for DrillUserException. You can wrap an existing exception, in this case it will first check if
this exception is, or wraps, a DrillUserException. If it does then the builder will use the user exception as it is
(it will ignore the message passed to the constructor) and will add any additional context information to the
exception's context
-
Method Summary
Modifier and TypeMethodDescriptionaddContext
(String value) add a string line to the bottom of the contextaddContext
(String name, double value) add a double value to the bottom of the contextaddContext
(String name, long value) add a long value to the bottom of the contextaddContext
(String value, Object... args) add a string line to the bottom of the contextaddContext
(String name, String value) add a string value to the bottom of the contextaddContext
(CustomErrorContext context) add DrillbitEndpoint identity to the context.build()
Deprecated.build
(org.slf4j.Logger logger) builds a user exception or returns the wrapped one.errorType
(UserBitShared.DrillPBError.ErrorType errorType) Sets the error type.sets or replaces the error message.pushContext
(String value) pushes a string value to the top of the contextpushContext
(String name, double value) pushes a double value to the top of the contextpushContext
(String name, long value) pushes a long value to the top of the contextpushContext
(String name, String value) pushes a string value to the top of the context
-
Method Details
-
message
sets or replaces the error message.This will be ignored if this builder is wrapping a user exception
- Parameters:
format
- format stringargs
- Arguments referenced by the format specifiers in the format string- Returns:
- this builder
- See Also:
-
addIdentity
add DrillbitEndpoint identity to the context.if the context already has a drillbitEndpoint identity, the new identity will be ignored
- Parameters:
endpoint
- drillbit endpoint identity
-
addContext
add a string line to the bottom of the context- Parameters:
value
- string line- Returns:
- this builder
-
addContext
add a string line to the bottom of the context- Parameters:
value
- string line- Returns:
- this builder
-
addContext
add a string value to the bottom of the context- Parameters:
name
- context namevalue
- context value- Returns:
- this builder
-
addContext
add a long value to the bottom of the context- Parameters:
name
- context namevalue
- context value- Returns:
- this builder
-
addContext
add a double value to the bottom of the context- Parameters:
name
- context namevalue
- context value- Returns:
- this builder
-
addContext
-
pushContext
pushes a string value to the top of the context- Parameters:
value
- context value- Returns:
- this builder
-
pushContext
pushes a string value to the top of the context- Parameters:
name
- context namevalue
- context value- Returns:
- this builder
-
pushContext
pushes a long value to the top of the context- Parameters:
name
- context namevalue
- context value- Returns:
- this builder
-
pushContext
pushes a double value to the top of the context- Parameters:
name
- context namevalue
- context value- Returns:
- this builder
-
build
builds a user exception or returns the wrapped one. If the error is a system error, the error message is logged to the givenLogger
.- Parameters:
logger
- the logger to write to- Returns:
- user exception
-
build
Deprecated.Usebuild(Logger)
instead. If the error is a system error, the error message is logged to thisUserException.logger
.Builds a user exception or returns the wrapped one.- Returns:
- user exception
build(Logger)
instead.