From 241f91c17969ac6b2836c009e05944093b89f085 Mon Sep 17 00:00:00 2001 From: sol Date: Fri, 10 Mar 2017 20:21:21 +0300 Subject: [PATCH] Error messages with the registration service for publishing dataset. Changed explicit calling of Datacite related error to generic message with the name of registration service being used. --- src/main/java/Bundle.properties | 3 +++ .../engine/command/impl/PublishDatasetCommand.java | 13 ++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/main/java/Bundle.properties b/src/main/java/Bundle.properties index f22c3cc8d75..389d02712e5 100755 --- a/src/main/java/Bundle.properties +++ b/src/main/java/Bundle.properties @@ -1021,6 +1021,9 @@ dataset.share.datasetShare=Share Dataset dataset.share.datasetShare.tip=Share this dataset on your favorite social media networks. dataset.share.datasetShare.shareText=View this dataset. dataset.publish.error.datacite=This dataset may not be published because the DataCite Service is currently inaccessible. Please try again. Does the issue continue to persist? +dataset.publish.error.DataCiteException=This dataset may not be published because the DataCite Service is currently inaccessible. Please try again. Does the issue continue to persist? +dataset.publish.error.HandleException=This dataset may not be published because the Handle.net Service is currently inaccessible. Please try again. Does the issue continue to persist? +dataset.publish.error.EZIDException=This dataset may not be published because the EZID Service is currently inaccessible. Please try again. Does the issue continue to persist? dataset.publish.error.doi=This dataset may not be published because the DOI update failed. dataset.delete.error.datacite=Could not deaccession the dataset because the DOI update failed. diff --git a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/PublishDatasetCommand.java b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/PublishDatasetCommand.java index c8bde3e6beb..12bb619d450 100644 --- a/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/PublishDatasetCommand.java +++ b/src/main/java/edu/harvard/iq/dataverse/engine/command/impl/PublishDatasetCommand.java @@ -97,8 +97,8 @@ public Dataset execute(CommandContext ctxt) throws CommandException { } } } catch (Throwable e) { - // TODO add a variant for EZId - throw new CommandException(ResourceBundle.getBundle("Bundle").getString("dataset.publish.error.datacite"), this); + String exceptionName=e.getClass().getSimpleName(); + throw new CommandException(ResourceBundle.getBundle("Bundle").getString("dataset.publish.error."+exceptionName), this); } } else { throw new IllegalCommandException("This dataset may not be published because its id registry service is not supported.", this); @@ -220,9 +220,12 @@ public Dataset execute(CommandContext ctxt) throws CommandException { } if (idServiceBean!= null && !idServiceBean.registerWhenPublished()) - if (!idServiceBean.publicizeIdentifier(savedDataset)) - throw new CommandException(ResourceBundle.getBundle("Bundle").getString("dataset.publish.error.datacite"), this); - + try{ + idServiceBean.publicizeIdentifier(savedDataset); + }catch (Throwable e) { + String exceptionName=e.getClass().getSimpleName(); + throw new CommandException(ResourceBundle.getBundle("Bundle").getString("dataset.publish.error."+exceptionName), this); + } PrivateUrl privateUrl = ctxt.engine().submit(new GetPrivateUrlCommand(getRequest(), savedDataset)); if (privateUrl != null) { logger.fine("Deleting Private URL for dataset id " + savedDataset.getId());