Implemented Deezspot-compliant error reporting on the backend

This commit is contained in:
Xoconoch
2025-06-14 19:45:10 -07:00
parent 2e966b4245
commit 6bd4cadd37
15 changed files with 606 additions and 377 deletions

View File

@@ -27,6 +27,7 @@ from routes.utils.watch.manager import (
check_watched_playlists,
get_watch_config,
) # For manual trigger & config
from routes.utils.errors import DuplicateDownloadError
logger = logging.getLogger(__name__) # Added logger initialization
playlist_bp = Blueprint("playlist", __name__, url_prefix="/api/playlist")
@@ -97,7 +98,17 @@ def handle_download(playlist_id):
"orig_request": orig_params,
}
)
# Removed DuplicateDownloadError handling, add_task now manages this by creating an error task.
except DuplicateDownloadError as e:
return Response(
json.dumps(
{
"error": "Duplicate download detected.",
"existing_task": e.existing_task,
}
),
status=409,
mimetype="application/json",
)
except Exception as e:
# Generic error handling for other issues during task submission
error_task_id = str(uuid.uuid4())