Handles ComponentException during Import VSP 20/119720/2
authorandre.schmid <andre.schmid@est.tech>
Mon, 22 Mar 2021 11:24:51 +0000 (11:24 +0000)
committerChristophe Closset <christophe.closset@intl.att.com>
Wed, 24 Mar 2021 15:47:38 +0000 (15:47 +0000)
The ComponentException was being treated as a GENERAL_ERROR and
loosing its message and HTTP status.

Change-Id: Ia632ec53f10920a69a53eed3aedee773ef5e4d2f
Issue-ID: SDC-3530
Signed-off-by: andre.schmid <andre.schmid@est.tech>
catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ResourceBusinessLogic.java

index 22fdc3b..fa58e61 100644 (file)
@@ -1488,7 +1488,12 @@ public class ResourceBusinessLogic extends ComponentBusinessLogic {
                 "An error has occurred during resource and resource instance creation", e);
             rollback(inTransaction, resource, createdArtifacts, nodeTypesNewCreatedArtifacts);
             throw new ByResponseFormatComponentException(e.getResponseFormat());
-        } catch (final Exception e) {
+        } catch (final ComponentException e) {
+                       log.error(EcompLoggerErrorCode.SCHEMA_ERROR, ResourceBusinessLogic.class.getName(),
+                               "An error has occurred during resource and resource instance creation", e);
+                       rollback(inTransaction, resource, createdArtifacts, nodeTypesNewCreatedArtifacts);
+                       throw new ByResponseFormatComponentException(e.getResponseFormat());
+               } catch (final Exception e) {
             log.error(EcompLoggerErrorCode.BUSINESS_PROCESS_ERROR, ResourceBusinessLogic.class.getName(),
                 "An error has occurred during resource and resource instance creation", e);
             rollback(inTransaction, resource, createdArtifacts, nodeTypesNewCreatedArtifacts);