diff --git a/src/main/java/common/GourouException.java b/src/main/java/common/GourouException.java new file mode 100644 index 0000000..2f92270 --- /dev/null +++ b/src/main/java/common/GourouException.java @@ -0,0 +1,71 @@ +package common; + +/** + * Custom exception class for general Gourou library operations. + */ + +public class GourouException extends RuntimeException +{ + public static final int GOUROU_INVALID_CLIENT = 101; + public static final int GOUROU_DEVICE_DOES_NOT_MATCH = 102; + public static final int GOUROU_ADEPT_ERROR = 103; + public static final int GOUROU_FILE_ERROR = 104; + public static final int GGOUROU_TAG_NOT_FOUND = 105; + public static final int GGOUROU_ADEPT_ERROR = 106; + public static final int GGOUROU_FILE_ERROR = 107; + public static final int GGOUROU_INVALID_PROPERTY = 108; + + public static final int DRM_ERR_ENCRYPTION_KEY_FP = 201; + public static final int DRM_INVALID_USER = 202; + public static final int DRM_INVALID_KEY_SIZE = 203; + public static final int DRM_ERR_ENCRYPTION_KEY = 204; + public static final int DRM_MISSING_PARAMETER = 205; + public static final int DRM_IN_OUT_EQUALS = 206; + public static final int DRM_VERSION_NOT_SUPPORTED = 207; + + public static final int FF_NOT_ACTIVATED = 301; + public static final int FF_INVALID_ACSM_FILE = 302; + public static final int FF_SERVER_INTERNAL_ERROR = 303; + public static final int FF_NO_HMAC_IN_ACSM_FILE = 304; + public static final int FF_NO_OPERATOR_URL = 305; + public static final int FF_REQUESTS_EXPIRED = 306; + + public static final int DW_NO_ITEM = 401; + public static final int DW_NO_EBX_HANDLER = 402; + + public static final int SIGN_INVALID_CREDENTIALS = 501; + + public static final int CLIENT_ZIP_ERROR = 601; // Example, if Client.zipOpen throws error + + private final int errorCode; + + public GourouException( String message ) + { + super( message ); + this.errorCode = -1; // Default or unknown error code + } + + public GourouException( int errorCode, String message ) + { + super( message ); + this.errorCode = errorCode; + } + + public GourouException( String message, Throwable cause ) + { + super( message, cause ); + this.errorCode = -1; + } + + public GourouException( int errorCode, String message, Throwable cause ) + { + super( message, cause ); + this.errorCode = errorCode; + } + + public int getErrorCode() + { + return errorCode; + } +} +