package com.perforce.client.api; public class P4ClientException extends Exception { private static final long serialVersionUID = 3433264162405960398L; /** * 32-bit error code * @serial Default serialization. */ private final int errorCode; public P4ClientException(int id, String msg) { super(msg); errorCode = id; } public P4ClientException(Throwable cause) { super(cause); errorCode = 0; } /** * Each error code is composed of 5 parts. * <pre> * sev - ErrorSeverity (4 bits) * arg - # of arguments, error specific (4 bits) * gen - generic error (8 bits) * sub - subsystem id (6 bits) * cod - code within subsystem, error specific (10 bits) * </pre> * @return 32 bits */ public int getErrorCode() { return errorCode; } /** * Gets code within subsystem, error specific. * @return 10 bits */ public int getSubCode() { return P4Error.subCode(errorCode); } /** * Gets the subsystem id, defined in errornum.h. * @return a Subsystem enum */ public P4Error.Subsystem getSubsystem() { return P4Error.toSubsystem(errorCode); } /** * Gets the generic error id, defined in errornum.h. * @return a Generic enum */ public P4Error.Generic getGeneric() { return P4Error.toGeneric(errorCode); } /** * Gets number of arguments, error specific. * @return 4 bits */ public int getArgCount() { return P4Error.argCount(errorCode); } /** * Gets error severity. * @return a Severity enum */ public P4Error.Severity getSeverity() { return P4Error.toSeverity(errorCode); } /** * Gets subsystem + subcode. * @return 16 bits */ public int getUniqueCode() { return P4Error.uniqueCode(errorCode); } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#2 | 4184 | Paul Krause | fix convertException bug; add missing classses; use enums for error codes | ||
#1 | 4181 | Paul Krause |
Rename //guest/paul_krause/perforce/api/java/wcvm/com/... //guest/paul_krause/perforce/api/java/wcvm/javax/... To //guest/paul_krause/perforce/api/java/wcvm/src-15/... |
||
//guest/paul_krause/perforce/api/java/wcvm/com/perforce/client/api/P4ClientException.java | |||||
#4 | 4173 | Paul Krause | add serialVersionUID | ||
#3 | 4129 | Paul Krause | use msgclient.h in place of old errclient.h | ||
#2 | 4103 | Paul Krause | ditch clienterror.h | ||
#1 | 4073 | Paul Krause | branch com.perforce.api package from michael_bishop | ||
//guest/michael_bishop/P4APIForJava/java/com/perforce/client/api/P4ClientException.java | |||||
#1 | 430 | Michael Bishop |
Initial checkin. Seems to work. Not very much testing. Not very much documentation. Some more commenting needs to take place. But, it's there to experiment with. |