From 0da8b68f7a3e504fbef14ccb9c1ca5aee1bac348 Mon Sep 17 00:00:00 2001 From: Oliver Hecker <8004361+ohecker@users.noreply.github.com> Date: Mon, 9 Oct 2023 10:14:34 +0200 Subject: [PATCH] Add specific exception indicating wrong curationDataSelector (#205) --- ...ExistingCurationDataSelectorException.java | 33 +++++++++++++++++++ .../curation/CurationProvider.java | 4 ++- 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 core/src/main/java/com/devonfw/tools/solicitor/componentinfo/curation/ComponentInfoAdapterNonExistingCurationDataSelectorException.java diff --git a/core/src/main/java/com/devonfw/tools/solicitor/componentinfo/curation/ComponentInfoAdapterNonExistingCurationDataSelectorException.java b/core/src/main/java/com/devonfw/tools/solicitor/componentinfo/curation/ComponentInfoAdapterNonExistingCurationDataSelectorException.java new file mode 100644 index 00000000..e285ba9d --- /dev/null +++ b/core/src/main/java/com/devonfw/tools/solicitor/componentinfo/curation/ComponentInfoAdapterNonExistingCurationDataSelectorException.java @@ -0,0 +1,33 @@ +package com.devonfw.tools.solicitor.componentinfo.curation; + +import com.devonfw.tools.solicitor.componentinfo.ComponentInfoAdapterException; + +/** + * This exception is thrown when an attempt is made to access a non-existing curation data selector when trying to + * retrieve curations. + * + */ +public class ComponentInfoAdapterNonExistingCurationDataSelectorException extends ComponentInfoAdapterException { + + /** + * Constructs a new ComponentInfoAdapterNonExistingCurationDataSelectorException with the specified detail message. + * + * @param message the detail message (which is saved for later retrieval by the getMessage() method). + */ + public ComponentInfoAdapterNonExistingCurationDataSelectorException(String message) { + + super(message); + } + + /** + * Constructs a new ComponentInfoAdapterNonExistingCurationDataSelectorException with the specified detail message and + * a nested Throwable cause. + * + * @param message the detail message (which is saved for later retrieval by the getMessage() method). + * @param cause the nested cause Throwable (which is saved for later retrieval by the getCause() method). + */ + public ComponentInfoAdapterNonExistingCurationDataSelectorException(String message, Throwable cause) { + + super(message, cause); + } +} \ No newline at end of file diff --git a/core/src/main/java/com/devonfw/tools/solicitor/componentinfo/curation/CurationProvider.java b/core/src/main/java/com/devonfw/tools/solicitor/componentinfo/curation/CurationProvider.java index 0ef12c63..be9377ca 100644 --- a/core/src/main/java/com/devonfw/tools/solicitor/componentinfo/curation/CurationProvider.java +++ b/core/src/main/java/com/devonfw/tools/solicitor/componentinfo/curation/CurationProvider.java @@ -18,8 +18,10 @@ public interface CurationProvider { * indicates that the default should be used. * @return the curation data if it exists or null if no curation exist for the package. * @throws ComponentInfoAdapterException if something unexpected happens + * @throws ComponentInfoAdapterNonExistingCurationDataSelectorException if the specified curationDataSelector could not be + * resolved */ ComponentInfoCuration findCurations(String packageUrl, String curationDataSelector) - throws ComponentInfoAdapterException; + throws ComponentInfoAdapterException, ComponentInfoAdapterNonExistingCurationDataSelectorException; } \ No newline at end of file