mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-11-27 03:15:08 +00:00
fix(api)!: send service and DRM errors as 422, not 502
Cloudflare replaces an origin 502 body with its own page, so clients got "502: Bad gateway" in place of the error and resent each failed licence. BREAKING CHANGE: SERVICE_ERROR and DRM_ERROR now return HTTP 422 instead of 502.
This commit is contained in:
@@ -94,10 +94,10 @@ class APIError(Exception):
|
||||
APIErrorCode.SESSION_NOT_FOUND: 404,
|
||||
APIErrorCode.TRACK_NOT_FOUND: 404,
|
||||
APIErrorCode.CONFLICT: 409,
|
||||
APIErrorCode.SERVICE_ERROR: 422,
|
||||
APIErrorCode.DRM_ERROR: 422,
|
||||
APIErrorCode.RATE_LIMITED: 429,
|
||||
APIErrorCode.INTERNAL_ERROR: 500,
|
||||
APIErrorCode.SERVICE_ERROR: 502,
|
||||
APIErrorCode.DRM_ERROR: 502,
|
||||
APIErrorCode.NETWORK_ERROR: 503,
|
||||
APIErrorCode.SERVICE_UNAVAILABLE: 503,
|
||||
APIErrorCode.DOWNLOAD_ERROR: 500,
|
||||
|
||||
@@ -5123,7 +5123,7 @@ def handle_proxy_license(
|
||||
)
|
||||
|
||||
# A service raises when the upstream licence server rejects the challenge.
|
||||
# Surface it as a structured licence error, not an uncaught 500 the edge turns into a 502.
|
||||
# Surface it as a structured licence error, not an uncaught 500.
|
||||
try:
|
||||
if drm_type == "widevine" and certificate:
|
||||
license_blob = service.get_widevine_service_certificate(
|
||||
|
||||
Reference in New Issue
Block a user