From c0a851aa3b89f1d3b5ab96355e1f2e8d5eb2424b Mon Sep 17 00:00:00 2001 From: nkumar2 Date: Fri, 2 Feb 2024 11:58:42 +0000 Subject: [PATCH] handle exception when ena assembly report is not found --- .../contigalias/datasource/ENAAssemblyDataSource.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/uk/ac/ebi/eva/contigalias/datasource/ENAAssemblyDataSource.java b/src/main/java/uk/ac/ebi/eva/contigalias/datasource/ENAAssemblyDataSource.java index b4c01557..5423a505 100644 --- a/src/main/java/uk/ac/ebi/eva/contigalias/datasource/ENAAssemblyDataSource.java +++ b/src/main/java/uk/ac/ebi/eva/contigalias/datasource/ENAAssemblyDataSource.java @@ -102,19 +102,19 @@ public Optional getAssemblyByAccession(String accession) throws public Optional downloadAssemblyReport(String accession) throws IOException { ENABrowser enaBrowser = factory.build(); enaBrowser.connect(); - Optional downloadPath; try { enaBrowser.connect(); - downloadPath = downloadAssemblyReport(enaBrowser, accession); - } finally { + return downloadAssemblyReport(enaBrowser, accession); + } catch (Exception e){ + logger.warn("Could not fetch Assembly Report from ENA for accession " + accession + "Exception: " + e); + return Optional.empty(); + }finally { try { enaBrowser.disconnect(); } catch (IOException e) { logger.warn("Error while trying to disconnect - ncbiBrowser (assembly: " + accession + ") : " + e); } } - - return downloadPath; } @Retryable(value = Exception.class, maxAttempts = 5, backoff = @Backoff(delay = 2000, multiplier = 2))