fix(api): let a core failure name its own API error code

This commit is contained in:
imSp4rky
2026-11-25 15:43:14 -07:00
parent e4ba7c2908
commit fcda47d995
23 changed files with 453 additions and 151 deletions
+7
View File
@@ -12,6 +12,7 @@ from requests import Session
from unshackle.core.config import config
from unshackle.core.drm import key_args as drm_key_args
from unshackle.core.drm.decrypters import decrypt_cenc, mp4decrypt, shaka_decrypt
from unshackle.core.remote_protocol import APIErrorCode
from unshackle.core.utilities import log_event
from unshackle.core.utils import run_proxy
@@ -193,11 +194,17 @@ class ClearKeyCENC:
class KIDNotFound(Exception):
"""KID (Encryption Key ID) was not found."""
error_code = APIErrorCode.DRM_ERROR
class CEKNotFound(click.ClickException):
"""CEK (Content Encryption Key) for KID was not found in License."""
error_code = APIErrorCode.DRM_ERROR
class EmptyLicense(click.ClickException):
"""License returned no Content Encryption Keys."""
error_code = APIErrorCode.DRM_ERROR
__all__ = ("ClearKeyCENC",)