public class PigException extends IOException
PigException
class. Details such as the source of the error, error message, error
code, etc. are contained in this class. The default values for the
attributes are:
errorSource = BUG
errorCode = 0
retriable = false
detailedMessage = null
location = nullModifier and Type | Field and Description |
---|---|
static byte |
BUG |
protected String |
detailedMessage |
static byte |
ERROR |
protected int |
errorCode |
protected byte |
errorSource |
static byte |
INPUT |
protected boolean |
markedAsShowToUser |
static byte |
REMOTE_ENVIRONMENT |
protected boolean |
retriable |
protected SourceLocation |
sourceLocation |
static byte |
USER_ENVIRONMENT |
Constructor and Description |
---|
PigException()
Create a new PigException with null as the error message.
|
PigException(String message)
Create a new PigException with the specified message.
|
PigException(String message,
int errCode)
Create a new PigException with the specified message and cause.
|
PigException(String message,
int errCode,
boolean retry)
Create a new PigException with the specified message and cause.
|
PigException(String message,
int errCode,
byte errSrc)
Create a new PigException with the specified message and cause.
|
PigException(String message,
int errCode,
byte errSrc,
boolean retry)
Create a new PigException with the specified message and cause.
|
PigException(String message,
int errCode,
byte errSrc,
boolean retry,
String detailedMsg)
Create a new PigException with the specified message and cause.
|
PigException(String message,
int errCode,
byte errSrc,
boolean retry,
String detailedMsg,
SourceLocation location)
Create a new PigException with the specified message and cause.
|
PigException(String message,
int errCode,
byte errSrc,
boolean retry,
String detailedMsg,
Throwable cause)
Create a new PigException with the specified message, error code, error source, retriable or not, detalied message for the developer and cause.
|
PigException(String message,
int errCode,
byte errSrc,
boolean retry,
String detailedMsg,
Throwable cause,
SourceLocation location)
Create a new PigException with the specified message, error code, error source, retriable or not, detalied message for the developer and cause.
|
PigException(String message,
int errCode,
byte errSrc,
SourceLocation location)
Create a new PigException with the specified message and cause.
|
PigException(String message,
int errCode,
byte errSrc,
Throwable cause)
Create a new PigException with the specified message and cause.
|
PigException(String message,
int errCode,
byte errSrc,
Throwable cause,
SourceLocation location)
Create a new PigException with the specified message and cause.
|
PigException(String message,
int errCode,
SourceLocation location)
Create a new PigException with the specified message and cause.
|
PigException(String message,
int errCode,
Throwable cause)
Create a new PigException with the specified message and cause.
|
PigException(String message,
int errCode,
Throwable cause,
SourceLocation location)
Create a new PigException with the specified message and cause.
|
PigException(String message,
SourceLocation location)
Create a new PigException with the specified message.
|
PigException(String message,
Throwable cause)
Create a new PigException with the specified message and cause.
|
PigException(Throwable cause)
Create a new PigException with the specified cause.
|
Modifier and Type | Method and Description |
---|---|
static byte |
determineErrorSource(int errCode)
A static method to determine the error source given the error code
|
String |
getDetailedMessage()
Returns the detailed message used by developers for debugging
|
int |
getErrorCode()
Returns the error code of the exception
|
byte |
getErrorSource()
Returns the error source of the exception.
|
boolean |
getMarkedAsShowToUser()
Check if this PigException is marked as the ones whose message is to be
displayed to the user.
|
SourceLocation |
getSourceLocation()
Return the location in the source that generated the exception.
|
static boolean |
isBug(byte errSource)
A static method to query if an error source is due to
a bug or not.
|
static boolean |
isInput(byte errSource)
A static method to query if an error source is due to
an input or not.
|
static boolean |
isRemoteEnvironment(byte errSource)
A static method to query if an error source is due to
the remote environment or not.
|
static boolean |
isUserEnvironment(byte errSource)
A static method to query if an error source is due to
the user environment or not.
|
boolean |
retriable()
Checks if the exception is retriable.
|
void |
setDetailedMessage(String detailMsg)
Set the detailed message of the exception
|
void |
setErrorCode(int code)
Set the error code of the exception
|
void |
setErrorSource(byte src)
Set the error source of the exception
|
void |
setMarkedAsShowToUser(boolean showToUser)
Mark this exception as a good candidate for showing its message to the
pig user
|
void |
setRetriable(boolean retry)
Set the retriable attribute of the exception
|
void |
setSourceLocation(SourceLocation location) |
String |
toString()
Returns a short description of this throwable.
|
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
public static final byte INPUT
public static final byte BUG
public static final byte USER_ENVIRONMENT
public static final byte REMOTE_ENVIRONMENT
public static final byte ERROR
protected int errorCode
protected byte errorSource
protected boolean retriable
protected String detailedMessage
protected boolean markedAsShowToUser
protected SourceLocation sourceLocation
public PigException()
public PigException(String message)
message
- - The error message (which is saved for later retrieval by the Throwable.getMessage() method) shown to the userpublic PigException(String message, SourceLocation location)
message
- - The error message (which is saved for later retrieval by the Throwable.getMessage() method) shown to the userlocation
- - The SourceLocation that generated this error.public PigException(Throwable cause)
cause
- - The cause (which is saved for later retrieval by the Throwable.getCause() method) indicating the source of this exception. A null value is permitted, and indicates that the cause is nonexistent or unknown.public PigException(String message, Throwable cause)
message
- - The error message (which is saved for later retrieval by the Throwable.getMessage() method) shown to the usercause
- - The cause (which is saved for later retrieval by the Throwable.getCause() method) indicating the source of this exception. A null value is permitted, and indicates that the cause is nonexistent or unknown.public PigException(String message, int errCode)
message
- - The error message (which is saved for later retrieval by the Throwable.getMessage() method) shown to the usererrCode
- - The error code shown to the userpublic PigException(String message, int errCode, SourceLocation location)
message
- - The error message (which is saved for later retrieval by the Throwable.getMessage() method) shown to the usererrCode
- - The error code shown to the userlocation
- - The SourceLocation that generated this error.public PigException(String message, int errCode, Throwable cause)
message
- - The error message (which is saved for later retrieval by the Throwable.getMessage() method) shown to the usererrCode
- - The error code shown to the usercause
- - The cause (which is saved for later retrieval by the Throwable.getCause() method) indicating the source of this exception. A null value is permitted, and indicates that the cause is nonexistent or unknown.public PigException(String message, int errCode, Throwable cause, SourceLocation location)
message
- - The error message (which is saved for later retrieval by the Throwable.getMessage() method) shown to the usererrCode
- - The error code shown to the usercause
- - The cause (which is saved for later retrieval by the Throwable.getCause() method) indicating the source of this exception. A null value is permitted, and indicates that the cause is nonexistent or unknown.location
- - The SourceLocation that generated this error.public PigException(String message, int errCode, byte errSrc)
message
- - The error message (which is saved for later retrieval by the Throwable.getMessage() method) shown to the usererrCode
- - The error code shown to the usererrSrc
- - The error sourcepublic PigException(String message, int errCode, byte errSrc, SourceLocation location)
message
- - The error message (which is saved for later retrieval by the Throwable.getMessage() method) shown to the usererrCode
- - The error code shown to the usererrSrc
- - The error sourcelocation
- - The SourceLocation that generated this error.public PigException(String message, int errCode, byte errSrc, Throwable cause)
message
- - The error message (which is saved for later retrieval by the Throwable.getMessage() method) shown to the usererrCode
- - The error code shown to the usererrSrc
- - The error sourcecause
- - The cause (which is saved for later retrieval by the Throwable.getCause() method) indicating the source of this exception. A null value is permitted, and indicates that the cause is nonexistent or unknown.public PigException(String message, int errCode, byte errSrc, Throwable cause, SourceLocation location)
message
- - The error message (which is saved for later retrieval by the Throwable.getMessage() method) shown to the usererrCode
- - The error code shown to the usererrSrc
- - The error sourcecause
- - The cause (which is saved for later retrieval by the Throwable.getCause() method) indicating the source of this exception. A null value is permitted, and indicates that the cause is nonexistent or unknown.location
- - The SourceLocation that generated this error.public PigException(String message, int errCode, boolean retry)
message
- - The error message (which is saved for later retrieval by the Throwable.getMessage() method) shown to the usererrCode
- - The error code shown to the userretry
- - If the exception is retriable or notpublic PigException(String message, int errCode, byte errSrc, boolean retry)
message
- - The error message (which is saved for later retrieval by the Throwable.getMessage() method) shown to the usererrCode
- - The error code shown to the usererrSrc
- - The error sourceretry
- - If the exception is retriable or notpublic PigException(String message, int errCode, byte errSrc, boolean retry, String detailedMsg)
message
- - The error message (which is saved for later retrieval by the Throwable.getMessage() method) shown to the usererrCode
- - The error code shown to the usererrSrc
- - The error sourceretry
- - If the exception is retriable or notdetailedMsg
- - The detailed message shown to the developerpublic PigException(String message, int errCode, byte errSrc, boolean retry, String detailedMsg, SourceLocation location)
message
- - The error message (which is saved for later retrieval by the Throwable.getMessage() method) shown to the usererrCode
- - The error code shown to the usererrSrc
- - The error sourceretry
- - If the exception is retriable or notdetailedMsg
- - The detailed message shown to the developerpublic PigException(String message, int errCode, byte errSrc, boolean retry, String detailedMsg, Throwable cause)
message
- - The error message (which is saved for later retrieval by the Throwable.getMessage() method) shown to the usererrCode
- - The error code shown to the usererrSrc
- - The error sourceretry
- - If the exception is retriable or notdetailedMsg
- - The detailed message shown to the developercause
- - The cause (which is saved for later retrieval by the Throwable.getCause() method) indicating the source of this exception. A null value is permitted, and indicates that the cause is nonexistent or unknown.public PigException(String message, int errCode, byte errSrc, boolean retry, String detailedMsg, Throwable cause, SourceLocation location)
message
- - The error message (which is saved for later retrieval by the Throwable.getMessage() method) shown to the usererrCode
- - The error code shown to the usererrSrc
- - The error sourceretry
- - If the exception is retriable or notdetailedMsg
- - The detailed message shown to the developercause
- - The cause (which is saved for later retrieval by the Throwable.getCause() method) indicating the source of this exception. A null value is permitted, and indicates that the cause is nonexistent or unknown.location
- - The SourceLocation that generated this error.public static boolean isInput(byte errSource)
errSource
- - byte that indicates the error sourcepublic static boolean isBug(byte errSource)
errSource
- - byte that indicates the error sourcepublic static boolean isUserEnvironment(byte errSource)
errSource
- - byte that indicates the error sourcepublic static boolean isRemoteEnvironment(byte errSource)
errSource
- - byte that indicates the error sourcepublic static byte determineErrorSource(int errCode)
errCode
- - integer error codepublic boolean retriable()
public void setRetriable(boolean retry)
retry
- - true if retriable; false otherwisepublic byte getErrorSource()
public void setErrorSource(byte src)
src
- - byte representing the error sourcespublic int getErrorCode()
public void setErrorCode(int code)
code
- - error codepublic String getDetailedMessage()
public void setDetailedMessage(String detailMsg)
detailMsg
- - detailed message to be used by developerspublic boolean getMarkedAsShowToUser()
public void setMarkedAsShowToUser(boolean showToUser)
public SourceLocation getSourceLocation()
public void setSourceLocation(SourceLocation location)
public String toString()
getErrorCode()
method
getLocalizedMessage
method
Copyright © 2007-2017 The Apache Software Foundation