From c701b903041c996ce419aabbca0ddeb270d9d730 Mon Sep 17 00:00:00 2001 From: Stefan Negru Date: Thu, 3 Nov 2022 12:45:00 +0200 Subject: [PATCH] add problematic files to error response --- metadata_backend/api/operators/file.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/metadata_backend/api/operators/file.py b/metadata_backend/api/operators/file.py index d798355b4..40c729608 100644 --- a/metadata_backend/api/operators/file.py +++ b/metadata_backend/api/operators/file.py @@ -3,6 +3,7 @@ from datetime import datetime from typing import Dict, List, Optional, Tuple +import ujson from aiohttp import web from pymongo.errors import ConnectionFailure, OperationFailure @@ -235,7 +236,11 @@ async def check_submission_files_ready(self, submission_id: str) -> None: f"in the submission with id: {submission_id}" ) LOG.error(reason) - raise web.HTTPBadRequest(reason=reason) + raise web.HTTPBadRequest( + reason=reason, + text=ujson.dumps({"problematic-files": problematic_files}), + content_type="application/json", + ) LOG.debug("All files have been marked as ready") except (ConnectionFailure, OperationFailure) as error: reason = f"Error happened while getting submission, err: {error}"