summaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/modules/blueprints
diff options
context:
space:
mode:
authorOleg Mitsura <oleg.mitsura@amdocs.com>2020-01-22 14:23:17 -0500
committerOleg Mitsura <oleg.mitsura@amdocs.com>2020-01-22 14:23:17 -0500
commit7093027dcaaaf7311a4f1fbf4b679032ba232e30 (patch)
treeca931906173979e44d82b306c380fad4591ac7b3 /ms/blueprintsprocessor/modules/blueprints
parent0e5c78cec1e1b1ce4d1f6488f6264ca1daffef58 (diff)
Enhancement better error messages.
Issue-ID: CCSDK-2036 rev1: initial commit. Signed-off-by: Oleg Mitsura <oleg.mitsura@amdocs.com> Change-Id: I0bc31a2a17a6dfedbb1870470e8bf6304be782b5
Diffstat (limited to 'ms/blueprintsprocessor/modules/blueprints')
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintEnhancer.kt35
1 files changed, 32 insertions, 3 deletions
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintEnhancer.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintEnhancer.kt
index 535021b34..b657199c7 100644
--- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintEnhancer.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/interfaces/BluePrintEnhancer.kt
@@ -164,8 +164,17 @@ interface BluePrintTypeEnhancerService {
bluePrintRuntimeService: BluePrintRuntimeService<*>,
properties: MutableMap<String, PropertyDefinition>
) {
+ val errorMap = linkedMapOf<String, BluePrintException>()
properties.forEach { propertyName, propertyDefinition ->
- enhancePropertyDefinition(bluePrintRuntimeService, propertyName, propertyDefinition)
+ try {
+ enhancePropertyDefinition(bluePrintRuntimeService, propertyName, propertyDefinition)
+ } catch (e: BluePrintException) {
+ errorMap[propertyName] = e
+ }
+ }
+ if (errorMap.isNotEmpty()) {
+ val nestedErrors = errorMap.keys.map { "[ property: ${errorMap[it]?.message} ]" }.joinToString(";")
+ throw BluePrintException("Failed to enhance properties $nestedErrors")
}
}
@@ -182,8 +191,17 @@ interface BluePrintTypeEnhancerService {
bluePrintRuntimeService: BluePrintRuntimeService<*>,
attributes: MutableMap<String, AttributeDefinition>
) {
+ val errorMap = linkedMapOf<String, BluePrintException>()
attributes.forEach { attributeName, attributeDefinition ->
- enhanceAttributeDefinition(bluePrintRuntimeService, attributeName, attributeDefinition)
+ try {
+ enhanceAttributeDefinition(bluePrintRuntimeService, attributeName, attributeDefinition)
+ } catch (e: BluePrintException) {
+ errorMap[attributeName] = e
+ }
+ }
+ if (errorMap.isNotEmpty()) {
+ val nestedErrors = errorMap.keys.map { "[ attribute: ${errorMap[it]?.message} ]" }.joinToString(";")
+ throw BluePrintException("Failed to enhance attributes $nestedErrors")
}
}
@@ -204,8 +222,19 @@ interface BluePrintTypeEnhancerService {
enhancers: List<BluePrintEnhancer<T>>
) {
if (enhancers.isNotEmpty()) {
+ val errorMap = linkedMapOf<String, BluePrintException>()
enhancers.forEach {
- it.enhance(bluePrintRuntimeService, name, definition as T)
+ try {
+ it.enhance(bluePrintRuntimeService, name, definition as T)
+ } catch (e: BluePrintException) {
+ errorMap[name] = e
+ }
+ }
+ if (errorMap.isNotEmpty()) {
+ val nestedErrors = errorMap.keys.map {
+ "${errorMap[it]?.message ?: errorMap[it].toString()}"
+ }.joinToString(";")
+ throw BluePrintException("$name-->$nestedErrors")
}
}
}