From bf40433495a02ceee65dae02431ea20ee790bfe9 Mon Sep 17 00:00:00 2001
From: phantomjinx
Date: Mon, 19 Mar 2018 15:32:29 +0000
Subject: [PATCH] Handle vdb deployment errors
* vdb.service.ts
* Correctly handles the status object returned from a vdb deployment by
assessing its deployment success flag
* api.service.ts
* Handle status object error messages ensuring they get printed to the
console.
---
ngapp/src/app/core/api.service.ts | 2 ++
ngapp/src/app/dataservices/shared/vdb.service.ts | 7 ++++++-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/ngapp/src/app/core/api.service.ts b/ngapp/src/app/core/api.service.ts
index 1ffc73d1..4db9955d 100644
--- a/ngapp/src/app/core/api.service.ts
+++ b/ngapp/src/app/core/api.service.ts
@@ -88,6 +88,8 @@ export abstract class ApiService {
msg = body.message;
else if (body.error)
msg = body.error;
+ else if (body.Information && body.Information.ErrorMessage1)
+ msg = body.Information.ErrorMessage1;
}
if (msg.length === 0 ) {
diff --git a/ngapp/src/app/dataservices/shared/vdb.service.ts b/ngapp/src/app/dataservices/shared/vdb.service.ts
index 51464cdc..edbe9daa 100644
--- a/ngapp/src/app/dataservices/shared/vdb.service.ts
+++ b/ngapp/src/app/dataservices/shared/vdb.service.ts
@@ -176,7 +176,12 @@ export class VdbService extends ApiService {
.post(environment.komodoTeiidUrl + VdbsConstants.vdbRootPath,
{ path: vdbPath}, this.getAuthRequestOptions())
.map((response) => {
- return response.ok;
+ let status = response.json();
+ if (status.Information.deploymentSuccess !== 'true') {
+ this.handleError(response);
+ }
+
+ return status.Information.deploymentSuccess === 'true';
})
.catch( ( error ) => this.handleError( error ) );
}