From f397f01964ec8d453d5527219528f4311f9b7c1f Mon Sep 17 00:00:00 2001 From: Paolo Di Tommaso Date: Thu, 13 Apr 2023 19:05:26 +0200 Subject: [PATCH] Improve plugin updater err handling Signed-off-by: Paolo Di Tommaso --- .../src/main/nextflow/plugin/PluginUpdater.groovy | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/modules/nf-commons/src/main/nextflow/plugin/PluginUpdater.groovy b/modules/nf-commons/src/main/nextflow/plugin/PluginUpdater.groovy index 58832220a2..b2feaebdf2 100644 --- a/modules/nf-commons/src/main/nextflow/plugin/PluginUpdater.groovy +++ b/modules/nf-commons/src/main/nextflow/plugin/PluginUpdater.groovy @@ -113,11 +113,16 @@ class PluginUpdater extends UpdateManager { // Check if it's a plugin meta file. The name must match the pattern `-X.Y.Z-meta.json` final matcher = META_REGEX.matcher(uri.tokenize('/')[-1]) if( matcher.matches() ) { - final pluginId = matcher.group(1) - final temp = File.createTempFile('nxf-','json') - temp.deleteOnExit() - temp.text = /[{"id":"${pluginId}", "releases":[ ${new URL(uri).text} ]}]/ - uri = 'file://' + temp.absolutePath + try { + final pluginId = matcher.group(1) + final temp = File.createTempFile('nxf-','json') + temp.deleteOnExit() + temp.text = /[{"id":"${pluginId}", "releases":[ ${new URL(uri).text} ]}]/ + uri = 'file://' + temp.absolutePath + } + catch (FileNotFoundException e) { + throw new IllegalArgumentException("Provided repository URL does not exists or cannot be accessed: $uri") + } } // create the update repository instance final fileName = uri.tokenize('/')[-1]