BluePrintManagmentGRPC handler should send failure message back to the client. 47/84147/1
authorprathamesh morde <prathamesh.morde@bell.ca>
Wed, 3 Apr 2019 21:54:45 +0000 (17:54 -0400)
committerprathamesh morde <prathamesh.morde@bell.ca>
Wed, 3 Apr 2019 22:12:30 +0000 (18:12 -0400)
-Added StreamObserver.onError so the client would be aware of failure if any.

Change-Id: Iecd019ef4ff4b4b4c522e0eb6e242770afdcdfcd
Issue-ID: CCSDK-1197
Signed-off-by: prathamesh morde <prathamesh.morde@bell.ca>
ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/BluePrintManagementGRPCHandler.kt

index 251ae2c..549d6cd 100644 (file)
@@ -62,7 +62,7 @@ open class BluePrintManagementGRPCHandler(private val bluePrintPathConfiguration
                 responseObserver.onNext(successStatus("Successfully uploaded CBA($blueprintId)...", request.commonHeader))
                 responseObserver.onCompleted()
             } catch (e: Exception) {
-                failStatus("request(${request.commonHeader.requestId}): Failed to upload CBA", e)
+                responseObserver.onError(failStatus("request(${request.commonHeader.requestId}): Failed to upload CBA", e))
             } finally {
                 deleteDir(bluePrintPathConfiguration.blueprintArchivePath, uploadId)
                 deleteDir(bluePrintPathConfiguration.blueprintWorkingPath, uploadId)
@@ -87,7 +87,7 @@ open class BluePrintManagementGRPCHandler(private val bluePrintPathConfiguration
                 responseObserver.onNext(successStatus("Successfully deleted $blueprint", request.commonHeader))
                 responseObserver.onCompleted()
             } catch (e: Exception) {
-                failStatus("request(${request.commonHeader.requestId}): Failed to delete $blueprint", e)
+                responseObserver.onError(failStatus("request(${request.commonHeader.requestId}): Failed to delete $blueprint", e))
             }
         }
     }