From 4b145c088e34ab61ac9051e25785563840e70497 Mon Sep 17 00:00:00 2001 From: Martin Beracochea Date: Fri, 16 Feb 2024 14:39:05 +0000 Subject: [PATCH] Add a bit of logging when posting a record to MGX --- emgapi/metagenomics_exchange.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/emgapi/metagenomics_exchange.py b/emgapi/metagenomics_exchange.py index ca17011aa..6c9103aed 100644 --- a/emgapi/metagenomics_exchange.py +++ b/emgapi/metagenomics_exchange.py @@ -106,7 +106,11 @@ def add_analysis(self, mgya: str, sequence_accession: str): The response object from the API request. """ data = self.generate_metadata(mgya, sequence_accession) - response = self.post_request(endpoint="datasets", data=data) + try: + response = self.post_request(endpoint="datasets", data=data) + except HTTPError as http_error: + logging.exception(f"POST request failed. HTTP Error: {http_error}") + raise http_error return response def check_analysis(self, mgya: str, sequence_accession: str, metadata=None):