Skip to content

Commit

Permalink
Parsing MessageEvent body to get error message (#203) (#210)
Browse files Browse the repository at this point in the history
  • Loading branch information
jak-atx authored Dec 8, 2017
1 parent a084997 commit 591f445
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions h5c/vic/src/vic-webapp/src/app/vch-view/vch-view.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,10 +289,13 @@ export class VicVchViewComponent implements OnInit, OnDestroy {
if (data.eventType === DELETE_VCH_MODAL_ERROR_EVENT) {
this.zone.run(() => {
let payload;
let body;
try {
payload = JSON.parse(data.payload)
payload = JSON.parse(data.payload);
body = JSON.parse(payload._body);
} catch (e) {}
this.error = payload.message || 'Error trying to delete the VCH';
const errMsg = 'Error trying to delete the VCH.';
this.error = body.message ? errMsg + ' ' + body.message : errMsg;
});
} else if (data.eventType === DATAGRID_REFRESH_EVENT) {
this.zone.run(() => {
Expand Down

0 comments on commit 591f445

Please sign in to comment.