diff --git a/core/views.py b/core/views.py index a7235296..58c494b3 100644 --- a/core/views.py +++ b/core/views.py @@ -1,5 +1,6 @@ import mimetypes import os +import traceback import uuid as uuid_module import requests @@ -491,15 +492,21 @@ def download_digital_asset_view(request, *args, **kwargs): return response except BadRequest as e: - return JsonResponse({"error": str(e)}, status=400) + return JsonResponse(camelize({"error": str(e)}), status=400) except DigitalAssetDownload.DoesNotExist: - return JsonResponse({"error": "Digital asset not found"}, status=404) + return JsonResponse(camelize({"error": "Digital asset not found"}), status=404) except Exception as e: capture_exception(e) return JsonResponse( - {"error": "An error occurred while trying to download the digital asset"}, + camelize( + { + "error": "An error occurred while trying to download the digital asset", + "traceback": traceback.format_exc() if settings.DEBUG else None, + "received": {"encoded_uuid": kwargs.get("encoded_uuid", "")}, + } + ), status=500, )